0% found this document useful (0 votes)
29 views18 pages

RDBMS Lab Question

The document outlines various SQL tasks, including creating and manipulating tables for students, employees, clients, and sales orders. It includes operations such as inserting records, displaying data, modifying attributes, and applying integrity rules. The tasks also cover creating relationships between tables and performing queries to extract specific information.

Uploaded by

gnana.svga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views18 pages

RDBMS Lab Question

The document outlines various SQL tasks, including creating and manipulating tables for students, employees, clients, and sales orders. It includes operations such as inserting records, displaying data, modifying attributes, and applying integrity rules. The tasks also cover creating relationships between tables and performing queries to extract specific information.

Uploaded by

gnana.svga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 18

1.

Create a student table with the following attributes name, register number, department, marks
in 5 subjects and total.
i. Insert a few records into student table.
ii. Display all the records
iii. Calculate the total marks for all the records
iv. Display the information of student name, register number and total only.

2. Create a table client-master with the following fields: client_no, name, address, city, state,
pincode, remarks, bal_due with suitable data types.
i. Create another table supplier_master from client_master.
ii. Rename the attribute client_no with supplier_no and the attribute name with
supplier_name in the supplier_master table
iii. Insert data into client_master
iv. Insert data into supplier_master from client_master.
v. Delete the row which is having the value chennai in the city attribute of client_master
table.
vi. Drop the client_master table

1. Create a table student_master with the following attributes name, regno, dept and year of
joining with suitable data types. Use Select command to do the following.
i. Display all the column in the student_ master table.
ii. Display the student’s name column only.
iii. Eliminate the duplicate entry in student_mastertable.
iv. Select the details of student who is studying computer science department
v. Sort the attribute name in alphabetical order.

2. Create a table sales_order with s_order_no, client_number, delivery_address, delivery_date and


order_status. Define the s_order_no as primary key using column level Constraints.
i. Create another table named as sales_order_copy with the same structure of sales_order
table. Define the s_order_no as primary key using table level constraints.
ii. Add a new column for storing salesman_number in sales_order using ALTER Command.
iii. Modify the size of delivery_address in sales_order table using ALTER command.
iv. Display the structure of sales_order table
1. Create a table student with name, roll number, gender, age and mobile number. Apply the
following integrity rules to the student table
i. The student name must be in capital letter.
ii. The roll number must be greater than zero.
iii. The age cannot be a null value.
iv. The gender must be “Male” or “Female” or “Transgender”
v. The mobile number may contain null values.

2. Create an Employee table with the following attribute employee_number, employee_name,


job_type, hire_date, department_number, salary and commission.
i. Query to display the Highest, Lowest, Sum and Average Salaries of all the Employees
ii. Query to display the employee_number and employee_name for all employees who earn
more than the average salary.
iii. Query to display the employee_name, salary and commission for all the employees who
earn commission.
iv. Sort the data in descending order of salary and commission
v. Query to display employee_name, salary and commission for all employees whose
commission is greater than their salary increased by 5%.

1. Create a student table with the following attributes name, registernumber, department, marks
in 5 subjects and total.
i. Insert few records into student table.
ii. Modify the name of the student as vignesh whose register number is 1002.
iii. Delete the records whose register number is 1003.
iv. Display all the records.

2. Create a DEPARTMENT table with the attributes of department_number and


department_name. Set the department_ number as a primary key.
i. Insert few records
ii. Display all the records
iii. Create an employee table with the following attribute employee_number,
employee_name, job and department_number. Set the employee_number as a primary key
and set the department_number as a foreign key.
iv. Query to display the employee details who are working in the particular
department_number.
v. Query to display employee_number, employee_name and job from the employee table
vi. Query to display unique jobs from the employee Table
vii. Query to display the employee_name concatenated by a job separated by a comma.
1. Create a table sales_order_details with the s_order_no as primary key and it contains the
following fields: product_no, description, qty_ordered, qty_disp, product_rate, profit_percent,
sell_price, supplier_name. Use Select command to do the following
i. Select each row and compute sell_price*.50 and sell_price*1.50 for each row selected.
ii. Select product_no, profit_percent, Sell_price where profit_per is not between 10 and 20
both inclusive.
iii. Select product_no, description, profit_percent, sell_price where profit_percent is not
between 20 and 30.
iv. Select the suppliername and product_no where suppliername has ‘r’ or ‘h’as second
character.

2. Create a DEPARTMENT table with the attributes of department_number and


department_name. Set the department number as a primary key.
i. Create an Employee table with the following attributes: employee_number, name,
job_type, department_number and location.
ii. Query to display Unique Listing of all Jobs that are in department_number 20.
iii. Query to display employee name, department_name and department_number for all the
employees.
iv. Query to display name, Job, department_number and department_name for all the
employees working at the Mumbai location.

1. Create an Employee table with the following attributes: employee_number, name, job and
manager_id. Set the manager_id as a foreign key for creating self referential structure.
i. Insert few records
ii. Display all the records
iii. Display the employee details who are working under particular manager_id.

2. Create a table sales_order with s_order_no, client_number, delivery_address, delivery_date and


order_status. Define the s_order_no as primary key using column level Constraints.
i. Create another table named as sales_order_copy with the same structure of sales_order
table. Define the s_order_no as primary key using table level constraints.
ii. Add a new column for storing salesman_number in sales_order using ALTER Command.
iii. Modify the size of delivery_address in sales_order table using ALTER command.
iv. Display the structure of sales_order table
1. Create an Employee table with the following attributes: employee_number, employee_name,
department_number, job and salary.
i. Query to display the employee_name and Salary of all the employees earning more than
20000 INR.
ii. Query to display employee_name and department_number for the particular employee
_number.
iii. Query to display employee_name and Salary for all employees whose salary is not in the
range of INR 15000 and INR 30000.

2. Create an Employee table with the following attribute employee_number, employee_name,


job_type, hire_date, department_number, salary and commission.
i. Query to display the Highest, Lowest, Sum and Average Salaries of all the Employees
ii. Query to display the employee_number and employee_name for all employees who earn
more than the average salary.
iii. Query to display the employee_name, salary and commission for all the employees who
earn commission.
iv. Sort the data in descending order of salary and commission
v. Query to display employee_name, salary and commission for all employees whose
commission is greater than their salary increased by 5%.

1. Create an Employee table with the following attribute employee_number, employee_name,


job_type, hire_date, department_number and salary.
i. Query to display employee_name and department_number of all the employees in
department_number 10 and Department number 20 in the alphabetical order by name.
ii. Query to display Name of all the employees where the third letter of their name is =A.
iii. Query to display Name with the 1st letter capitalized and all other letter lowercase
iv. Query to display Name of all employees either have two R‘s or have two A‘s in their name.

2. Create a DEPARTMENT table with the attributes of department_number and


department_name. Set the department_ number as a primary key.
viii. Insert few records
i. Display all the records
ii. Create an employee table with the following attribute employee_number,
employee_name, job and department_number. Set the employee_number as a primary key
and set the department_number as a foreign key.
iii. Query to display the employee details who are working in the particular
department_number.
iv. Query to display employee_number, employee_name and job from the employee table
v. Query to display unique jobs from the employee Table
vi. Query to display the employee_name concatenated by a job separated by a comma.
1. Create an Employee table with the following attributes: employee_number, name, job,
hire_date and manager_id. Set the manager_id as a forein key for creating self referential
structure.
i. Query to display name and Hire Date of every Employee who was hired in 2007.
ii. Query to display name and calculate the number of months between today and the date
each employee was hired.
iii. Query to display name and job of all employees who don‘t have a current Manager.

2. Create a DEPARTMENT table with the attributes of department_number and


department_name. Set the department number as a primary key.
i. Create an Employee table with the following attributes: employee_number, name,
job_type, department_number and location.
ii. Query to display Unique Listing of all Jobs that are in department_number 20.
iii. Query to display employee name, department_name and department_number for all the
employees.
iv. Query to display name, Job, department_number and department_name for all the
employees working at the Mumbai location.

1. Create a table sales_order_details with the s_order_no as primary key and it contains the
following fields: product_no, description, qty_ordered, qty_disp, product_rate, profit_percent,
sell_price, supplier_name. Use Select command to do the following
i. Select each row and compute sell_price*.50 and sell_price*1.50 for each row selected.
ii. Select product_no, profit_percent, Sell_price where profit_per is not between 10 and 20
both inclusive.
iii. Select product_no, description, profit_percent, sell_price where profit_percent is not
between 20 and 30.
iv. Select the suppliername and product_no where suppliername has ‘r’ or ‘h’as second
character.

2. Create a table client-master with the following fields: client_no, name, address, city, state,
pincode, remarks, bal_due with suitable data types.
i. Create another table supplier_master from client_master.
ii. Rename the attribute client_no with supplier_no and the attribute name with
supplier_name in the supplier_master table
iii. Insert data into client_master
iv. Insert data into supplier_master from client_master.
v. Delete the row which is having the value chennai in the city attribute of client_master
table.
vi. Drop the client_master table
1. Create a table student_master with the following attributes name, regno, dept and year of
joining with suitable data types. Use Select command to do the following.
i. Display all the column in the student_ master table.
ii. Display the student’s name column only.
iii. Eliminate the duplicate entry in student_mastertable.
iv. Select the details of student who is studying computer science department
v. Sort the attribute name in alphabetical order.

2. Create a table sales_order with s_order_no, client_number, delivery_address, delivery_date and


order_status. Define the s_order_no as primary key using column level Constraints.
i. Create another table named as sales_order_copy with the same structure of sales_order
table. Define the s_order_no as primary key using table level constraints.
ii. Add a new column for storing salesman_number in sales_order using ALTER Command.
iii. Modify the size of delivery_address in sales_order table using ALTER command.
iv. Display the structure of sales_order table

1. Create a table student with name, roll number, gender, age and mobile number. Apply the
following integrity rules to the student table
i. The student name must be in capital letter.
ii. The roll number must be greater than zero.
iii. The age cannot be a null value.
iv. The gender must be “Male” or “Female” or “Transgender”
v. The mobile number may contain null values.

2. Create an Employee table with the following attribute employee_number, employee_name,


job_type, hire_date, department_number, salary and commission.
i. Query to display the Highest, Lowest, Sum and Average Salaries of all the Employees
ii. Query to display the employee_number and employee_name for all employees who earn
more than the average salary.
iii. Query to display the employee_name, salary and commission for all the employees who
earn commission.
iv. Sort the data in descending order of salary and commission
v. Query to display employee_name, salary and commission for all employees whose
commission is greater than their salary increased by 5%.
1. Create a student table with the following attributes name, registernumber, department, marks
in 5 subjects and total.
i. Insert few records into student table.
ii. Modify the name of the student as vignesh whose register number is 1002.
iii. Delete the records whose register number is 1003.
iv. Display all the records.

2. Create a DEPARTMENT table with the attributes of department_number and


department_name. Set the department_ number as a primary key.
i. Insert few records
ii. Display all the records
iii. Create an employee table with the following attribute employee_number,
employee_name, job and department_number. Set the employee_number as a primary key
and set the department_number as a foreign key.
iv. Query to display the employee details who are working in the particular
department_number.
v. Query to display employee_number, employee_name and job from the employee table
vi. Query to display unique jobs from the employee Table
vii. Query to display the employee_name concatenated by a job separated by a comma.

1. Create an Employee table with the following attributes: employee_number, name, job,
hire_date and manager_id. Set the manager_id as a forein key for creating self referential
structure.
i. Query to display name and Hire Date of every Employee who was hired in 2007.
ii. Query to display name and calculate the number of months between today and the date
each employee was hired.
iii. Query to display name and job of all employees who don‘t have a current Manager.

2. Create a DEPARTMENT table with the attributes of department_number and


department_name. Set the department number as a primary key.
i. Create an Employee table with the following attributes: employee_number, name,
job_type, department_number and location.
ii. Query to display Unique Listing of all Jobs that are in department_number 20.
iii. Query to display employee name, department_name and department_number for all the
employees.
iv. Query to display name, Job, department_number and department_name for all the
employees working at the Mumbai location.
1. Create an Employee table with the following attributes: employee_number, employee_name,
department_number, job and salary.
i. Query to display the employee_name and Salary of all the employees earning more than
20000 INR.
ii. Query to display employee_name and department_number for the particular employee
_number.
iii. Query to display employee_name and Salary for all employees whose salary is not in the
range of INR 15000 and INR 30000.

2. Create a table client-master with the following fields: client_no, name, address, city, state,
pincode, remarks, bal_due with suitable data types.
i. Create another table supplier_master from client_master.
ii. Rename the attribute client_no with supplier_no and the attribute name with
supplier_name in the supplier_master table
iii. Insert data into client_master
iv. Insert data into supplier_master from client_master.
v. Delete the row which is having the value chennai in the city attribute of client_master
table.
vi. Drop the client_master table

1. Create a student table with the following attributes name, register number, department, marks
in 5 subjects and total.
i. Insert a few records into student table.
ii. Display all the records
iii. Calculate the total marks for all the records
iv. Display the information of student name, register number and total only.

2. Create a table sales_order with s_order_no, client_number, delivery_address, delivery_date and


order_status. Define the s_order_no as primary key using column level Constraints.
i. Create another table named as sales_order_copy with the same structure of sales_order
table. Define the s_order_no as primary key using table level constraints.
ii. Add a new column for storing salesman_number in sales_order using ALTER Command.
iii. Modify the size of delivery_address in sales_order table using ALTER command.
iv. Display the structure of sales_order table
1. Create a student table with the following attributes name, registernumber, department, marks
in 5 subjects and total.
i. Insert few records into student table.
ii. Modify the name of the student as vignesh whose register number is 1002.
iii. Delete the records whose register number is 1003.
iv. Display all the records.

2. Create an Employee table with the following attribute employee_number, employee_name,


job_type, hire_date, department_number, salary and commission.
i. Query to display the Highest, Lowest, Sum and Average Salaries of all the Employees
ii. Query to display the employee_number and employee_name for all employees who earn
more than the average salary.
iii. Query to display the employee_name, salary and commission for all the employees who
earn commission.
iv. Sort the data in descending order of salary and commission
v. Query to display employee_name, salary and commission for all employees whose
commission is greater than their salary increased by 5%.

1. Create a table student with name, roll number, gender, age and mobile number. Apply the
following integrity rules to the student table
i. The student name must be in capital letter.
ii. The roll number must be greater than zero.
iii. The age cannot be a null value.
iv. The gender must be “Male” or “Female” or “Transgender”
v. The mobile number may contain null values.

2. Create a DEPARTMENT table with the attributes of department_number and


department_name. Set the department_ number as a primary key.
i. Insert few records
ii. Display all the records
iii. Create an employee table with the following attribute employee_number,
employee_name, job and department_number. Set the employee_number as a primary key
and set the department_number as a foreign key.
iv. Query to display the employee details who are working in the particular
department_number.
v. Query to display employee_number, employee_name and job from the employee table
vi. Query to display unique jobs from the employee Table
vii. Query to display the employee_name concatenated by a job separated by a comma.
1. Create a table student_master with the following attributes name, regno, dept and year of
joining with suitable data types. Use Select command to do the following.
i. Display all the column in the student_ master table.
ii. Display the student’s name column only.
iii. Eliminate the duplicate entry in student_mastertable.
iv. Select the details of student who is studying computer science department
v. Sort the attribute name in alphabetical order.

2. Create a DEPARTMENT table with the attributes of department_number and


department_name. Set the department number as a primary key.
i. Create an Employee table with the following attributes: employee_number, name,
job_type, department_number and location.
ii. Query to display Unique Listing of all Jobs that are in department_number 20.
iii. Query to display employee name, department_name and department_number for all the
employees.
iv. Query to display name, Job, department_number and department_name for all the
employees working at the Mumbai location.

1. Create a table sales_order_details with the s_order_no as primary key and it contains the
following fields: product_no, description, qty_ordered, qty_disp, product_rate, profit_percent,
sell_price, supplier_name. Use Select command to do the following
i. Select each row and compute sell_price*.50 and sell_price*1.50 for each row selected.
ii. Select product_no, profit_percent, Sell_price where profit_per is not between 10 and 20
both inclusive.
iii. Select product_no, description, profit_percent, sell_price where profit_percent is not
between 20 and 30.
iv. Select the suppliername and product_no where suppliername has ‘r’ or ‘h’as second
character.

2. Create a table client-master with the following fields: client_no, name, address, city, state,
pincode, remarks, bal_due with suitable data types.
i. Create another table supplier_master from client_master.
ii. Rename the attribute client_no with supplier_no and the attribute name with
supplier_name in the supplier_master table
iii. Insert data into client_master
iv. Insert data into supplier_master from client_master.
v. Delete the row which is having the value chennai in the city attribute of client_master
table.
vi. Drop the client_master table
1. Create an Employee table with the following attributes: employee_number, name, job and
manager_id. Set the manager_id as a foreign key for creating self referential structure.
i. Insert few records
ii. Display all the records
iii. Display the employee details who are working under particular manager_id.

2. Create a table sales_order with s_order_no, client_number, delivery_address, delivery_date and


order_status. Define the s_order_no as primary key using column level Constraints.
i. Create another table named as sales_order_copy with the same structure of sales_order
table. Define the s_order_no as primary key using table level constraints.
ii. Add a new column for storing salesman_number in sales_order using ALTER Command.
iii. Modify the size of delivery_address in sales_order table using ALTER command.
iv. Display the structure of sales_order table

1. Create an Employee table with the following attributes: employee_number, employee_name,


department_number, job and salary.
i. Query to display the employee_name and Salary of all the employees earning more than
20000 INR.
ii. Query to display employee_name and department_number for the particular employee
_number.
iii. Query to display employee_name and Salary for all employees whose salary is not in the
range of INR 15000 and INR 30000.

2. Create an Employee table with the following attribute employee_number, employee_name,


job_type, hire_date, department_number, salary and commission.
i. Query to display the Highest, Lowest, Sum and Average Salaries of all the Employees
ii. Query to display the employee_number and employee_name for all employees who earn
more than the average salary.
iii. Query to display the employee_name, salary and commission for all the employees who
earn commission.
iv. Sort the data in descending order of salary and commission
v. Query to display employee_name, salary and commission for all employees whose
commission is greater than their salary increased by 5%.
1. Create an Employee table with the following attribute employee_number, employee_name,
job_type, hire_date, department_number and salary.
i. Query to display employee_name and department_number of all the employees in
department_number 10 and Department number 20 in the alphabetical order by name.
ii. Query to display Name of all the employees where the third letter of their name is =A.
iii. Query to display Name with the 1st letter capitalized and all other letter lowercase
iv. Query to display Name of all employees either have two R‘s or have two A‘s in their name.

2. Create a DEPARTMENT table with the attributes of department_number and


department_name. Set the department_ number as a primary key.
i. Insert few records
ii. Display all the records
iii. Create an employee table with the following attribute employee_number,
employee_name, job and department_number. Set the employee_number as a primary key
and set the department_number as a foreign key.
iv. Query to display the employee details who are working in the particular
department_number.
v. Query to display employee_number, employee_name and job from the employee table
vi. Query to display unique jobs from the employee Table
vii. Query to display the employee_name concatenated by a job separated by a comma.

1. Create an Employee table with the following attributes: employee_number, name, job,
hire_date and manager_id. Set the manager_id as a forein key for creating self referential
structure.
i. Query to display name and Hire Date of every Employee who was hired in 2007.
ii. Query to display name and calculate the number of months between today and the date
each employee was hired.
iii. Query to display name and job of all employees who don‘t have a current Manager.

2. Create a DEPARTMENT table with the attributes of department_number and


department_name. Set the department number as a primary key.
i. Create an Employee table with the following attributes: employee_number, name,
job_type, department_number and location.
ii. Query to display Unique Listing of all Jobs that are in department_number 20.
iii. Query to display employee name, department_name and department_number for all the
employees.
iv. Query to display name, Job, department_number and department_name for all the
employees working at the Mumbai location.
1. Create a student table with the following attributes name, register number, department, marks
in 5 subjects and total.
i. Insert a few records into student table.
ii. Display all the records
iii. Calculate the total marks for all the records
iv. Display the information of student name, register number and total only.

2. Create a table client-master with the following fields: client_no, name, address, city, state,
pincode, remarks, bal_due with suitable data types.
i. Create another table supplier_master from client_master.
ii. Rename the attribute client_no with supplier_no and the attribute name with
supplier_name in the supplier_master table
iii. Insert data into client_master
iv. Insert data into supplier_master from client_master.
v. Delete the row which is having the value chennai in the city attribute of client_master
table.
vi. Drop the client_master table

1. Create a student table with the following attributes name, registernumber, department, marks
in 5 subjects and total.
i. Insert few records into student table.
ii. Modify the name of the student as vignesh whose register number is 1002.
iii. Delete the records whose register number is 1003.
iv. Display all the records.

2. Create a table sales_order with s_order_no, client_number, delivery_address, delivery_date and


order_status. Define the s_order_no as primary key using column level Constraints.
i. Create another table named as sales_order_copy with the same structure of sales_order
table. Define the s_order_no as primary key using table level constraints.
ii. Add a new column for storing salesman_number in sales_order using ALTER Command.
iii. Modify the size of delivery_address in sales_order table using ALTER command.
iv. Display the structure of sales_order table
1. Create a table student with name, roll number, gender, age and mobile number. Apply the
following integrity rules to the student table
i. The student name must be in capital letter.
ii. The roll number must be greater than zero.
iii. The age cannot be a null value.
iv. The gender must be “Male” or “Female” or “Transgender”
v. The mobile number may contain null values.

2. Create an Employee table with the following attribute employee_number, employee_name,


job_type, hire_date, department_number, salary and commission.
i. Query to display the Highest, Lowest, Sum and Average Salaries of all the Employees
ii. Query to display the employee_number and employee_name for all employees who earn
more than the average salary.
iii. Query to display the employee_name, salary and commission for all the employees who
earn commission.
iv. Sort the data in descending order of salary and commission
v. Query to display employee_name, salary and commission for all employees whose
commission is greater than their salary increased by 5%.

1. Create a table student_master with the following attributes name, regno, dept and year of
joining with suitable data types. Use Select command to do the following.
i. Display all the column in the student_ master table.
ii. Display the student’s name column only.
iii. Eliminate the duplicate entry in student_mastertable.
iv. Select the details of student who is studying computer science department
v. Sort the attribute name in alphabetical order.

2. Create a DEPARTMENT table with the attributes of department_number and


department_name. Set the department_ number as a primary key.
viii. Insert few records
i. Display all the records
ii. Create an employee table with the following attribute employee_number,
employee_name, job and department_number. Set the employee_number as a primary key
and set the department_number as a foreign key.
iii. Query to display the employee details who are working in the particular
department_number.
iv. Query to display employee_number, employee_name and job from the employee table
v. Query to display unique jobs from the employee Table
vi. Query to display the employee_name concatenated by a job separated by a comma.
1. Create a table sales_order_details with the s_order_no as primary key and it contains the
following fields: product_no, description, qty_ordered, qty_disp, product_rate, profit_percent,
sell_price, supplier_name. Use Select command to do the following
i. Select each row and compute sell_price*.50 and sell_price*1.50 for each row selected.
ii. Select product_no, profit_percent, Sell_price where profit_per is not between 10 and 20
both inclusive.
iii. Select product_no, description, profit_percent, sell_price where profit_percent is not
between 20 and 30.
iv. Select the suppliername and product_no where suppliername has ‘r’ or ‘h’as second
character.

2. Create a DEPARTMENT table with the attributes of department_number and


department_name. Set the department number as a primary key.
i. Create an Employee table with the following attributes: employee_number, name,
job_type, department_number and location.
ii. Query to display Unique Listing of all Jobs that are in department_number 20.
iii. Query to display employee name, department_name and department_number for all the
employees.
iv. Query to display name, Job, department_number and department_name for all the
employees working at the Mumbai location.

1. Create an Employee table with the following attributes: employee_number, name, job and
manager_id. Set the manager_id as a foreign key for creating self referential structure.
i. Insert few records
ii. Display all the records
iii. Display the employee details who are working under particular manager_id.

2. Create a table client-master with the following fields: client_no, name, address, city, state,
pincode, remarks, bal_due with suitable data types.
i. Create another table supplier_master from client_master.
ii. Rename the attribute client_no with supplier_no and the attribute name with
supplier_name in the supplier_master table
iii. Insert data into client_master
iv. Insert data into supplier_master from client_master.
v. Delete the row which is having the value chennai in the city attribute of client_master
table.
vi. Drop the client_master table
1. Create an Employee table with the following attributes: employee_number, employee_name,
department_number, job and salary.
i. Query to display the employee_name and Salary of all the employees earning more than
20000 INR.
ii. Query to display employee_name and department_number for the particular employee
_number.
iii. Query to display employee_name and Salary for all employees whose salary is not in the
range of INR 15000 and INR 30000.

2. Create a table sales_order with s_order_no, client_number, delivery_address, delivery_date and


order_status. Define the s_order_no as primary key using column level Constraints.
i. Create another table named as sales_order_copy with the same structure of sales_order
table. Define the s_order_no as primary key using table level constraints.
ii. Add a new column for storing salesman_number in sales_order using ALTER Command.
iii. Modify the size of delivery_address in sales_order table using ALTER command.
iv. Display the structure of sales_order table

1. Create an Employee table with the following attribute employee_number, employee_name,


job_type, hire_date, department_number and salary.
i. Query to display employee_name and department_number of all the employees in
department_number 10 and Department number 20 in the alphabetical order by name.
ii. Query to display Name of all the employees where the third letter of their name is =A.
iii. Query to display Name with the 1st letter capitalized and all other letter lowercase
iv. Query to display Name of all employees either have two R‘s or have two A‘s in their name.

2. Create an Employee table with the following attribute employee_number, employee_name,


job_type, hire_date, department_number, salary and commission.
i. Query to display the Highest, Lowest, Sum and Average Salaries of all the Employees
ii. Query to display the employee_number and employee_name for all employees who earn
more than the average salary.
iii. Query to display the employee_name, salary and commission for all the employees who
earn commission.
iv. Sort the data in descending order of salary and commission
v. Query to display employee_name, salary and commission for all employees whose
commission is greater than their salary increased by 5%.
1. Create an Employee table with the following attributes: employee_number, name, job,
hire_date and manager_id. Set the manager_id as a forein key for creating self referential
structure.
i. Query to display name and Hire Date of every Employee who was hired in 2007.
ii. Query to display name and calculate the number of months between today and the date
each employee was hired.
iii. Query to display name and job of all employees who don‘t have a current Manager.

2. Create a DEPARTMENT table with the attributes of department_number and


department_name. Set the department_ number as a primary key.
i. Insert few records
ii. Display all the records
iii. Create an employee table with the following attribute employee_number,
employee_name, job and department_number. Set the employee_number as a primary key
and set the department_number as a foreign key.
iv. Query to display the employee details who are working in the particular
department_number.
v. Query to display employee_number, employee_name and job from the employee table
vi. Query to display unique jobs from the employee Table
vii. Query to display the employee_name concatenated by a job separated by a comma.

1. Create a student table with the following attributes name, register number, department, marks
in 5 subjects and total.
i. Insert a few records into student table.
ii. Display all the records
iii. Calculate the total marks for all the records
iv. Display the information of student name, register number and total only.

2. Create a DEPARTMENT table with the attributes of department_number and


department_name. Set the department number as a primary key.
i. Create an Employee table with the following attributes: employee_number, name,
job_type, department_number and location.
ii. Query to display Unique Listing of all Jobs that are in department_number 20.
iii. Query to display employee name, department_name and department_number for all the
employees.
iv. Query to display name, Job, department_number and department_name for all the
employees working at the Mumbai location.
1. Create a student table with the following attributes name, registernumber, department, marks
in 5 subjects and total.
i. Insert few records into student table.
ii. Modify the name of the student as vignesh whose register number is 1002.
iii. Delete the records whose register number is 1003.
iv. Display all the records.

2. Create a table client-master with the following fields: client_no, name, address, city, state,
pincode, remarks, bal_due with suitable data types.
i. Create another table supplier_master from client_master.
ii. Rename the attribute client_no with supplier_no and the attribute name with
supplier_name in the supplier_master table
iii. Insert data into client_master
iv. Insert data into supplier_master from client_master.
v. Delete the row which is having the value chennai in the city attribute of client_master
table.
vi. Drop the client_master table

You might also like