sql queries
sql queries
a) Create a table student with following information fields: rollno with numeric type, name, and branch as
string data type. Do the following operations
i. Alter table by adding primary key for column rollno.
ii. Increase or decrease the size of branch column.
iii. Add new column called class with string type, having length 20.
iv. Remove column branch
v. Change the name of the table from student to stud
vi. Remove the primary key constraint.
vii. Remove all the records from the table without using delete command
viii. Remove the entire table structure and its records
1.a) Write a PL/SQL block to evaluate the grade of the student from the student table by accepting student
number. Attributes of student table is studno , studname, mark1, mark2, mark3
1. a) Create a table employee with attributes empno, ename, job(i.e., designation), mgr, hiredate,
sal, commission, deptno. And table department with attributes deptno, dname, loc.
i. How many clerks are there in the company?
ii. Which department has exactly one employee as clerk?
iii. Which department has the highest number of clerks? Show the deptno and count.
iv. How many employees are there in each department?
v. List the lowest salary for different jobs used in a company and list them in descending order.
vi. Which department average salary is the lowest among all? Show the deptno, average salary.
vii. List the minimum, maximum and average salary for each job.
viii. List the names of the employees whose name starts with LA.
ix. List the names of the employees whose name contains LA.
x. List the names of the employees whose name ends with KE.
xi. List the minimum and maximum salaries.
xii. Compute the difference between maximum and minimum salary
b) Create a trigger that should put restriction on user, who trying to insert or delete or modify
records on employee table, either on week end or on non working hours.
Note: Assume that working hours is 8.00 A.M to 8.00 P.M on all week days (Monday to Friday)
1. a) Create a table
Order (order_id number (5), person_id number(3), odate date) Person (person_id number (3),
lastname varchar2 (20), firstname varchar2 (20), address varchar2(20))
Demonstrate the following Join operations
a. Inner join
b. left outer join
c. right outer join
d. full outer join
1. a) Create a table student with following information fields: rollno with numeric type, name, and
branch as string data type. Do the following operations
[