Professional Documents
Culture Documents
1. You are given a responsibility to design a database for an online sale company. In the initial phase
you are required to create the following tables using appropriate data type for each column.
a. Table name CUSTOMER
Column names:
CustomerID
CustomerName
Address
City
PostalCode
Country
ColorID ColorName
ColorId nvarchar(15),
ColorName nvarchar(15)
);
2. After creation of the tables, it was observed that some of the details are missing from the tables.
Make the following changes to the above created table
a. Insert a new Column ContactNumber in table CUSTOMER
b. Assuming the online sales is considering no classification into department remove the column
DNO from EMPLOYEE
c. Insert a new Column Color in table PRODUCT
3. At later stage of database management it was decided that Color table was not essential and can be
removed from the database. Write a query to remove Color table
4.
a.
CustomerID
AZMC_00001
AZMC_00002
AZMC_00014
CustomerName
Amar
Alex
Aleen
AZMC_00341
Arun
AZMC_00145
Raj
AZMC_00162
Bob
Address
NIT Delhi Narela
145 Downtown
New York
23-B Midtown
Boston
123 street lane,
Campus Town
Florida
56 Railway Line
Colony
Lucknow
78 Street hill station
Utha
City
New Delhi
New York
PostalCode
110040
Country
India
USA
Boston
02108
USA
Florida
32003
USA
Lucknow
India
227105
Utah
84101
USA
b.
ProdID
PROD_001x2
PROD_010x2
PROD_231x2
PROD_131x2
PROD_141x2
BrandID
Samsung
LG
Samsung
Sony
Toshiba
ColorID
C_001
C_001
C_255
C_035
C_005
Size
43
24
50
123
24
Dimension
1920 x 1080
1366 x 768
1920 x 1080
3840 x 2160
1280 x 800
is_available
yes
no
yes
no
no
c.
FNAME
LNAME
EMPID
DOB
ADDRESS
SALARY
DNO
JOININGDATE
Ram
Pankaj
Rahul
Thakur
Makhija
Kumar
Emp_0001
Emp_0011
Emp_0191
12-4-1976
16-09-1983
19-12-1991
42000
16000
25000
D_01
D_11
D_01
10-5-2012
16-12-2010
4-09-2015
Dinesh
Chauhan
Emp_0231
4-05-1987
Moti Nagar
Rohini
Ramesh
Nagar
Rajiv
Chowk
12000
D_25
15-9-2009
5. Write queries to display the following output [Select specific columns from table]
a.
CustomerID
AZMC_00001
AZMC_00002
AZMC_00014
CustomerName
Amar
Alex
Aleen
AZMC_00341
Arun
AZMC_00145
Raj
AZMC_00162
Bob
Address
NIT Delhi Narela
145 Downtown
New York
23-B Midtown
Boston
123 street lane,
Campus Town
Florida
56 Railway Line
Colony
Lucknow
78 Street hill station
Utha
City
New Delhi
New York
PostalCode
110040
Country
India
USA
Boston
02108
USA
Florida
32003
USA
Lucknow
India
227105
Utah
'84101
USA
b.
FNAME
Ram
Pankaj
Rahul
LNAME
Thakur
Makhija
Kumar
EMPID
Emp_0001
Emp_0011
Emp_0191
Dinesh
Chauhan
Emp_0231
ADDRESS
Moti Nagar
Rohini
Ramesh
Nagar
Rajiv
Chowk
DNO
D_01
D_11
D_01
D_25
c.
ProdID
BrandID
PROD_001x2
PROD_010x2
PROD_231x2
PROD_131x2
PROD_141x2
Samsung
LG
Samsung
Sony
Toshiba
d.
EMPID
DOB
JOININGDATE
Emp_0001
Emp_0011
Emp_0191
Emp_0231
12-4-1976
16-09-1983
19-12-1991
4-05-1987
10-5-2012
16-12-2010
4-09-2015
15-9-2009
6. Write queries to display the following output [Select specific records from table]
a. Display records of employee whose EMPID is Emp_0191
select * from employee where empid='emp_0191';
LAB 2
1. On Update (Tables from assignment 1)
a. A customer having id AZMC_00001 made a request for an address change. write a query
for the same, change address to '145 Patel Nagar'
update customer set address='145 Patel Nagar' where cutomerid = 'AZMC_00001'
b. A customer named raj has now moved from Lucknow to Allahabad make appropriate
changes in the database
update customer set address='allahabad',city='allahabad' where( city='lucknow' and
customername='raj')
c. Change the dimension for PROD_010x2 to 1300 x 678
update product set dimension='1300*678' where prodid='prod_010x2'
3. Create the following table in the database and answer the following queries