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

CS-2202 Database Systems Lab Task 05: DDL Commands

The University of Azad Jammu and Kashmir Muzaffarabad


Department of Software Engineering

Lab Task 05
Semester: Spring 2021 Date: May 6, 2021
Course Title: Database Systems (Lab) Course Code: CS-2202
Instructor: Engr. Tahir Abbasi Due Date: May 9, 2021 before 11:59 PM

Instructions:
 You must submit your lab task well within time. Late work IS NOT ACCEPTED and will lead to ZERO
CREDIT.
 The lab task should be uploaded on QOBE.
 Do your own work. Any type of cheating/sharing of lab task or part of the lab task will result in ZERO
CREDIT.

1. Using the Query Wizard, create a new database and name the database as your full name in all
lowercase letters. (For example, Kaynat Khatib would save her database as kaynat_khatib_lab_task_05.

2. Create a new table in your database and name the table as PUBLISHERS.

i. Write the corresponding SQL commands (DDL) to add the following attributes into your
table.

Attribute Data Type Field Size


P_ID VARCHAR 4
P_Name VARCHAR 50
Address VARCHAR 50
State VARCHAR 15
Phone VARCHAR 20

ii. Using corresponding SQL command (DDL), make the following changes into your table:

a. Add the following attribute into your table.


Attribute Data Type Field Size
Email_ID VARCHAR 30
b. Change the data type of column P_ID from VARCHAR to INT.
c. Change the data type of column Phone from VARCHAR to INT.

iii. Using the corresponding SQL command (DDL), change the name of table to PUBLISHER.

iv. Using corresponding SQL command (DDL), delete the table from your database.

1/2
CS-2202 Database Systems Lab Task 05: DDL Commands

3. Create a new table in your database and name the table as BOOKS.

i. Write the corresponding SQL commands (DDL) to create the following table in your
database.

Attribute Data Type Field Size


ISBN VARCHAR 4
Book_Title VARCHAR 50
Category VARCHAR 20
Price NUMERIC 6,2
Copyright_Date NUMERIC 4
Year NUMERIC 4
P_ID VARCHAR 4

ii. Using corresponding SQL command (DDL), make the following changes into your table:

a. Add the following attribute into your table.


Attribute Data Type Field Size
Page_Count NUMERIC 4
b. Change the data type of column ISBN from VARCHAR to INT.
c. Change the data type of column Copyright_Date from NUMERIC to VARCHAR.

iii. Using corresponding SQL command (DDL), delete the table from your database.

4. Delete the created database from your system.

5. Documentation:
 Copy and paste all of your SQL DDL Statements into a Word document. Add your SQL
Management Studio Screenshots showing your SQL DDL statements execution and the results of
your “Create Table” statements.
 Attach your completed file and submit by due date.

Good Luck

2/2

You might also like