Sie sind auf Seite 1von 18

ASSIGNMENT

OF
DBMS

SUBMITTED TO:

Ruhi mam
SUBMITTED BY:

Savita Kumari
ROLL NO-
(201780056)
MCA- 2ND YEAR
Assignment-1&2

Create Table:- SalesPeople


Snum is Primary key to be implemented as Table Level Constraint.
Sname is Unique constraint to be implemented as column level constraint .

QUERY:

Insert values into SalesPeople table:-


Show SalesPeople Table:-

Create Table:- Customers

Cnum is Primary Key to be implemented as column level constraint.


City has not null constraint .
Snum is foreign key constraint to be implemented as table level refers Snum column of
SalesPeople table.
QUERY:

Insert values into Customers table:-


Show Customers Table:-

Create Table:- Orders


Onum is Primary key to be implemented as table level.
Cnum is foreign key to be implemented as column level constraints refers to Cnum column
of Customers table.
Snum is foreign key constraint to be implemented as table level constraints refers Snum
column of SalesPeople table.
QUERY:
Insert values into Orders table:-

Show Orders Table:-


Assignment-3
1. Use substitution variable for entering the data.
2. Create a table Sales1 directly from existing table Salespeople. Observe what happens.

OUTPUT:-

3. Observe the difference between delete, drop and truncate by writing SQL statements.

DELETE:- The DELETE Statement is used to delete rows from a table.


DROP:- The SQL DROP command is used to remove an object from the database.

TRUNCATE:- The SQL TRUNCATE command is used to delete all the rows from the table
and free the space containing the table.
4. Delete the detail of Sales1 named Peel.

5. Salesperson Serres has left the company. Assign her customers to Motika.
Output:-

6. Increase the Commission of all salespeople residing in London by 20%.


7. City of Salesperson Axelord has been entered wrong. His city is Phoneix. Correct the
entry.
Assignment 4
1. Add a new column Fathers Name in SalesPeople table.

2. Drop Primary Key of Customer table.


3. Add not null constraint to Amt in Orders table.
4. Add unique constraint to Cname in Customers table.

5. Rename Sname of SalesPeople table to SalesPeopleName.


6. Rename SalesPeople table to SPTable.
7. Decrease/Increase the domain of city field of Customers table.

INCREASE:-

OUTPUT:-
DECREASE:-

OUTPUT:-

8. Drop customers table.

Das könnte Ihnen auch gefallen