You are on page 1of 2

MANIPULATIO

13 : TABLE CREATION AND DATA N COMMANDS


o,opte' 591

fti!j'~ ~,S a ' Co■ W Z a I DO I e-ia PO o ,-,_ _

,- A. Short Answer Questions/Conceptual Quest·ions ·»n, n=nc: ·1


Type ·
are different divisions of SQL and commands ? c·ive examples of comm d .
1. What ch .
division.
., What is foreign key? How do you define a foreign k . an s m ea
1,,
ey m your table ?
3. How is FOREIGN KEY commands different from PRIMARY KEY command ?
4 . How is FOREIGN KEY commands related to the PRIMARY KEY ?
s. How do you enforce business rules on a database 7
6. What are table constraints ? What are column constraints 7 How are these two different ?
7. What i_s def~ult value ? How do you define it 7 What is the default value of column for which no default
value 1s define ? .
8. Differentiate between :
(1) DROP TABLE, DROP DATABASE (ir) DROP.TABL~ DROP clause of ALTER TABLE.

Type B : Application Based Questions


than 100)).
1. Insert all those records of table Accounts into table Pending where amt_outstanding is more
2. Increase salary of employee recrods by 10% (table employee).
3. Give commision of Rs. 500 to all employees who joined in year 1982 (table Empl).
4. Allocate the department situated in BOSTON to employee with employee number 7500 (ftlblts
FMPL. n,pt)
5. Given the following tables :
Orders (OrdNo, Ord_date, ProdNo#, Qty)
Product (ProdNo, Oescp, Price)
Payment (OrdNo, Pment)
Write a query to delete all those records from table Orders whose complete payment has been made.
6. Enlist the names of all tables created by you.
7. Write Query statements for following transaction : (Consider tables of question 12)
(i) Increase price of all products by 10%.
(ii) List the details of all orders whose payment is pending as per increased price.
(iii) Decrease prices by 10% for all those products for which orders were placed 10 months
before.
1
8· Modify table Empt, add another column called Grade of VARCHAR type, size into it.
9· In the added column Grade, assign grades as follows : .
if sal is in ran e 700-1500, Grade is 1 ; if sal is in range 1500-2200, Grade 1B 2
g . 3 • if sal is in range 3000 - Grade is 4
if sal is in range 2200 - 3000, Grade as ,
10 I that declares column Grade not null.
· Add a constraint (NN-Grade) in table Emp
11. Insert a record of your choice in table EmpL Make sure not to enter Grade.
1•ts size to 2.
12· Modify the definition of column Grade. Inaease
13 _ the following table instance chart.
· Drop the table Empl.
14· Create the table Department table based on
Neme
Column Name 10
VARCHAR
. NUMBER
25
8
~ 592
ent wi th da ta fro m
COMPUTER SCIENCE WITH

tab le de pt Inc lud ing on ly req


uir ed columns.
PYTHON _ XII

par tm
15. Po pu lat e the tab le De
tab le ins tan ce cha rt.
Cr eat e the tab le Em plo yee based on the fol low ing
16.
De pt_ lD
Las t Na me
Firs t Na me
Column Name ID
NU MB ER
VA RC HA R
VA RC HA R
Da ta Type NUMBER
8
25
8 25
Length

d De par tm ent .
17. Dr op table Em plo yee an art .
pe r following Table Ins tan ce Ot
18. Cr eat e tab le Cu sto me r as
cod e Cu st_ Pho ne
Cu st Address1 Cu st_ Ad dre ss2 Pin
Cu st Na me
Column Name Cu st_ lD
VA RC HA R NU MB ER VA RC HA R
VA RC HA R VA RC HA R
Da laty pe NU MB ER
6 10
20 30
7 30
Length
me r.
of da ta typ e VA RO iA R and size 30 to the tab le Cu sto
19. Ad d on e col um n Em ail AR.(10).
re col um n Cu sto me rln com eG rou p of dat aty pe VARCH
20. Ad d on e mo
nt information, in the table.
21. Ins ert few rec ord s wi th rel eva me r.
com eG rou p from table Cu sto
22. Dr op the col um n Cu sto me rln Cliart.
pe r following Table Instance
23. Cr eat e tab le De par tm ent as
DepUD De ptN am e
Cotumn Na me

Key Type Pri ma ry

NO T NU LL
Nulls/Unique

NU MB ER VA RC HA R
Datatype
2 20
Length

Cb art .
pe r following Table Ins tan ce
24. Cre ate table Employee as
Em pAd dre ss Em pP hon e Em pS al DepUD
Em plD Em pN am e
Column Na me
Foreign
Key Typ e Prim ary

NO T NU LL
NuUs/Unique
Department
Fk Tab le
De pt ID
Fk Column

Datatype NU MB ER VA RC HA R VA RC HA R VA RC HA R NU MB ER VA RC HA R
- -
6 20 30 10 9,2 2
Length

les created by you.


25. View str uct ure s of all tab

You might also like