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

SQL Exercise1

Uploaded by

mahadwadmayuri
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

SQL Exercise1

Uploaded by

mahadwadmayuri
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

SQL Exercise 1

1. Create the table SEMP with the following structure:-

EMPNO CHAR(4)
EMPNAME CHAR(20)
BASIC FLOAT
DEPTNO CHAR(2)
DEPTHEAD CHAR(4)

2. Create the table SDEPT with the following structure:-

DEPTNO CHAR(2)
DEPTNAME CHAR(15)

3. Insert into the SDEPT table the following values:-

10, Development
20, Training

4. Insert into the SEMP table the following values:-

0001, SUNIL, 6000, 10


0002, HIREN, 8000, 20
0003, ALI, 4000, 10, 0001
0004, GEORGE, 6000, 0002

Sameer Dehadrai
Create S, P, J, SPJ tables as specified below and insert a few rows in each table:-

SUPPLIER - S
(S#, Sname, Status, City)
PARTS - P
(P#, Pname, Color, Weight, City)
PROJECTS - J
(J#, Jname, City)
SUPPLIER-PARTS-PROJECT - SPJ
(S#, P#, J#, Qty)

Sample data for S# column:- ‘S1’, ‘S2’, ‘S3’, etc.


Sample data for P# column:- ‘P1’, ‘P2’, ‘P3’, etc.
Sample data for J# column:- ‘J1’, ‘J2’, ‘J3’, etc.
Sample data for Status column:- 10, 20, 30, etc.

Write the SELECT queries to do the following:-

5. Display all the data from the S table.

6. Display only the S# and SNAME fields from the S table.

7. Display the PNAME and COLOR from the P table for the CITY=”London”.

8. Display all the Suppliers from London.

9. Display all the Suppliers from Paris or Athens.

10. Display all the Projects in Athens.

11. Display all the Partnames with the weight between 12 and 14 (inclusive of both).

12. Display all the Suppliers with a Status greater than or equal to 20.

13. Display all the Suppliers except the Suppliers from London.

14. Display only the Cities from where the Suppliers come from.

15. Assuming that the Part Weight is in GRAMS, display the same in
MILLIGRAMS and KILOGRAMS.

Sameer Dehadrai

You might also like