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

SQL Queries (Work Sheet1-DDL1)

CREATE

1. Create table STUDENT with the following attributes.
STDNO, STDNAME, ADDRESS, PHONENO, BRANCH
2. Create table STUD with the following columns and constraints.
STDNO PRIMARY KEY,
STDNAME NOT NULL,
ADDRESS NOT NULL,
PHONENO UNIQUE,
BRANCH CHECK (B.SC, BCA, B.Com, BBM)
3. Create table BRANCH with the following columns.
BRANCHNO, Street, City, PINCODE.
4. Create table ACCT_DETAILS with the following columns
ACNO PRIMARY KEY,
ACTYPE CHECK (Savings, Current, Salary, Corporate),
NAME NOT NULL,
MINBAL NOT NULL,
BAL NOT NULL,
PHONENO UNIQUE
PHOTO
SIGN
5. Create table BACCT_DETAILS with the same structure ACCT_DETAILS.


ALTER

1. Add column BRANCH to the table ACCT_DETAILS.
2. Add UNIQUE constraint to the PINCODE column of BRANCH table.
3. Modify the column ADDRESS NOT NULL to NULL.
4. Delete primary key constraint from the table STUD.
5. Add primary key constraint to column BRANCHNO of table BRANCH.
6. Increase the size of the column Address of STUD table.
7. Delete column PHONENO from STUDENT table.
8. Decrease the size of the column BRANCH in STUD table.

DROP

1. Delete the table BRANCH.


Prepared by:- Ratna Babu Narne

You might also like