Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

SQL COMMANDS

Q1.
a) Write a command to create a table Employee with the following structure:
Column Name Type Constraint
ID Number (4) Primary Key
First_Name Varchar(30) Not NULL
Last_Name VarChar(30) Not NULL
User_ID Varchar(10) Unique
Salary Decimal(9,2) Greater than
5000
b) Insert into one record mentioning column list in the Insert clause
c) Insert into second record without mentioning column list in the Insert clause
d) Add a column Status of varchar(15) and set default status as ‘Permanent’.
Q2. Write a command to create another table JOB with the following structure:
Column Name Type Constraint
Job_ID Number (4) Primary Key
Job_Des Varchar(30) Not NULL
Alloc_on Date Not NULL
Due_on Date Not NULL
Emp_Id Number (4) Foreign Key
related to ID
column
earlier
created table
Employee

Q3. Write a SQL statement to create a Primary Key constraint on the ‘P_ID’
column of a table Persons, when the table is already created.
Q4. Write a command to display the structure of the table JOB.

You might also like