SQL Table
SQL Table
TABLE : EMPLOYEE
Column name Datatype Size Constraint
Ecode Integer 5 Primary Key
Name Varchar 20 Can never to left empty
Dept Varchar 20 Default “HRA”
Date_of_birth Date
Gender Char 1
Designation Varchar 20
Salary Integer 10
Consider the following table Product. Write SQL queries for the following statements
TABLE : PRODUCT
Table : TRAINER
TID TNAME CITY HIREDATE SALARY
101 Sunaina Mumbai 1998-10-15 90000
102 Anamika Delhi 1994-12-24 80000
103 Deepti Chandigarh 2001-12-21 82000
104 Meenakshi Delhi 2002-12-25 78000
105 Richa Mumbai 1996-01-12 95000
106 Maniprabha Chennai 2001-12-12 69000
Table : COURSE
CID CNAME FEES STARTDATE TID
C201 AGDCA 12000 2018-07-02 101
C202 ADCA 15000 2018-07-15 103
C203 DCA 10000 2018-10-01 102
C204 DDTP 9000 2018-09-15 104
C205 DHN 20000 2018-08-01 101
C206 O LEVEL 18000 2018-07-25 105
1. Create the tables Trainer (TID is primary key) and Course (CID is primary key)
2. Insert the given data into the respective tables.
3. Display the structure of the tables.
4. Display the Trainer Name, City & Salary in descending order of their Hiredate.
5. To display the TNAME and CITY of Trainer who joined the Institute in the month of December
2001.
6. To display TNAME, HIREDATE, CNAME, STARTDATE from tables TRAINER and COURSE
of all those courses whose FEES is less than or equal to 10000.
7. To display number of Trainers from each city.
8. To increase the fees of the course by 10% where the fee >=5000 and <=12000.
9. Display the Trainer Name, City, hiredate and Salary of the trainers whose name starts with M.
SQL - 5
Consider the following tables SUBJECT and TEACHER.
iii. Remove the details of all students whose marks are below 33.
iv. Display subject and number of teachers teaching the same subject.
vi. Display the detail of all students in ascending order of their marks
SQL : 7
Table: STORE
Table: ITEM
Table: SUPPLIER
Table: PRODUCT
PID PNAME QTY PRICE COMPANY SUPCODE
101 DIGITAL CAMERA 14X 120 12000 RENIX S01
102 DIGITAL PAD 11i 100 2200 DIGI POP S02
103 PEN DRIVE 16 GB 500 1100 STOREKING S01
104 LED SCREEN 32 70 28000 DISPEXPERTS S02
105 CAR GPS SYSTEM 60 12000 MOVEON S03
TABLE : RECIPIENT