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

Lab Test

The document provides SQL queries to create two tables, Employee and Dept, insert values, and count employees. The Employee table has constraints of primary key on E_id, not null on name, and check on salary less than 100,000. Values are inserted for 5 employees. The Dept table lists 4 department IDs and names. A final query counts the number of employees in the Employee table.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Lab Test

The document provides SQL queries to create two tables, Employee and Dept, insert values, and count employees. The Employee table has constraints of primary key on E_id, not null on name, and check on salary less than 100,000. Values are inserted for 5 employees. The Dept table lists 4 department IDs and names. A final query counts the number of employees in the Employee table.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Q3.

Write the queries for Table Creation & insertion:


Table Name: Employee
E_i E_Na Ag Salar Dept_
d me  e  y  id
1400 01
1  Ammu 61 
0
Shank 4400 04
2  34 
ar 0 
7800 03
3 Hrithik 45
0
5600 02
4 Muthu 39
0
4000 04
5  Minu 34 
0
 
Table Name: Dept
D_i D_name  
d  
01 Testing
02 Analyst  
03 Training
04 Development

Create all the above tables with constraints. 


Primary Key: E_id , D_ID
Not Null : Name
Check: Salary should not more than Rs. 100000/-
You have to provide queries on table creation, value insertion
and finally, display the entire table with values.
.
Q4. Write a query in SQL to count the number of employees in
the employee table.

You might also like