0% found this document useful (0 votes)
9 views

Shop Item - No Item - Name Price Qty Total: Program No: Page No: Date

Uploaded by

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

Shop Item - No Item - Name Price Qty Total: Program No: Page No: Date

Uploaded by

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

Program No: Page No:

Date:

SQL

1. Consider the following table SHOP. Write SQL commands for the questions (i) to (v).

Item_No Item_Name Price Qty Total

1021 Hamam 24 2 48

987 Colgate 10 2 10

3623 Surf 52 1 52

277 Shampoo 2 5 10

4855 Face wash 57 1 57

i. To display all the items whose Price is greater than 50.


ii. To increase the Total of Item_No 987 as 20 (Price*Qty).
iii. To list all the Item_Name and Qty in ascending order of Item_No whose Qty is less than 3.
iv. To add an extra column Discount which accepts decimal numbers.
v. To delete the column(s) whose quantity is 1.

OUTPUT:
Program No: Page No:

Date:

i. To display all the items whose Price is greater than 50.

ii. To increase the Total of Item_No 987 as 20 (Price*Qty).

iii. To list all the Item_Name and Qty in ascending order of Item_No whose Qty is less than 3.
Program No: Page No:

Date:

iv. To add an extra column Discount which accepts decimal numbers.

v. To delete the column(s) whose quantity is 1.


Program No: Page No:

Date:

2. Consider the following table EMPLOYEE. Write SQL commands for the questions (i) to (v).

Eid Ename Qual Gender Salary

901 Kumar BE M 12000

201 Louie MCA M 30500

110 Varshini BTech F 13025

718 Drishya MCA F 11600

120 Nissi Ann MCA F 19000

i. To display Eid and Ename whose Qual is MCA.


ii. To list the employees in descending order of their Salary.
iii. To display the count of the employees according to their Gender.
iv. To find out the minimum Salary and maximum Salary of the employees.
v. To delete the records whose Salary is above 15000.

OUTPUT:
Program No: Page No:

Date:

i. To display Eid and Ename whose Qual is MCA.

ii. To list the employees in descending order of their Salary.

iii. To display the count of the employees according to their Gender.


Program No: Page No:

Date:

iv. To find out the minimum Salary and maximum Salary of the employees.

v. To delete the records whose Salary is above 15000.


Program No: Page No:

Date:

3. Consider the following table STUDENT. Write SQL commands for the questions (i) to (v).

Roll_no Stud_name Maths Computer Physics Chemistry

1201 Hari 48 89 79 99

1202 Karthik 78 100 89 72

1203 Varun 52 90 93 88

1204 Gokul 69 81 75 96

1205 Vignesh 57 100 100 98

i. To increase the Maths mark of all the students by 5.


ii. To display the Students details whose mark is 100 in Computer.
iii. To display the Name and Roll Number of the Students whose name starts with letter ‘V’.
iv. To set Roll Number column as Primary Key.
v. To delete the records whose Physics marks are below 85.

OUTPUT:
Program No: Page No:

Date:

i. To increase the Maths mark of all the students by 5.

ii. To display the Students details whose mark is 100 in Computer.


Program No: Page No:

Date:

iii. To display the Name and Roll Number of the Students whose name starts with letter ‘V’.

iv. To set Roll Number column as Primary Key.

v. To delete the records whose Physics marks are below 85.


Program No: Page No:

Date:

4. Consider the following table COLLEGE. Write SQL commands for the questions (i) to (v).

ID_No Name College Branch Roll_No Age

91 Ramesh NIT MECH 8642046 20

72 Jagan MANIPAL LAW 8642079 24

64 Kunal IIT AEROSPACE 8642011 18

18 Haneefa IIT CIVIL 8642054 22

78 Michael IIT CSE 8642002 20

i. To display all the students studying at IIT under the age of 20.
ii. To change the Branch of Name ‘Kunal’ to CSE.
iii. To display the number of students in IIT, NIT & MANIPAL.
iv. To display the details in ascending order of Roll Number.
v. To delete the records which have Age greater than 20.
OUTPUT:
Program No: Page No:

Date:

i. To display all the students studying at IIT under the age of 20.

ii. To change the Branch of Name ‘Kunal’ to CSE.


Program No: Page No:

Date:

iii. To display the number of students in IIT, NIT & MANIPAL.

iv. To display the details in ascending order of Roll Number.

v. To delete the records which have Age greater than 20.

You might also like