Batch C1 Name Roll Number Class Division USIT 3P4 Database Management Systems Subject/Course Batch C1 Instructions 1. Each Question carries 10 marks. 2 X 10 = 20 Marks
Question 1: Create the following tables:
Works (Person_name, Company_name, Salary); Lives (Person_name, Street, City); Insert 5 records accordingly Write SQL statements for the following 1. Display name of all salary in descending order. 2. Display details of Works table. 3. Add a column Pid of type varchar and size 7 as primary key to Works table. 4. Display name of person whose name start with ‘h’ from lives table. 5. Retrieve the names of all person whose salary is between Rs. 30,000 and Rs. 50,000. 6. Perform Cross Join between two tables. Answer 1:
Output/ Result/ Screen Shots:
Vidyalankar School of Information Technology Question 2: Create table with following attributes and insert the following columns into it & perform the following queries onto it: - ID LAST_NAME FIRST_NAME USERID SALARY 1 Patel Ralph rpatel 895 2 Dancs Betty bdancs 860 3 Biri Ben bbiri 1100 4 Newman Chad cnewman 750 5 Ropeburn Audrey aropebur 1550 Perform the following queries on the above table 1. Change the last name of employee 3 to Newman. 2. Change the salary to 1000 for all employees with a salary less than 870. 3. Delete Biri from the MY_EMPLOYEE table 4. Create the EMPLOYEES2 table based on the structure of the EMPLOYEES table. Include only the EMPLOYEE_ID, FIRST_NAME, LAST_NAME, SALARY, and DEPARTMENT_ID columns. Name the columns in your new table ID, FIRST_NAME, LAST_NAME, SALARY, and DEPT_ID, respectively. 5. Drop the LAST_NAME column from the EMP table. Confirm your modification by checking the description of the table. Answer 2: