Docsity

DBMS Basic Excercises, Quizzes of Database Management Systems (DBMS)

Toggle sidebar
bg1
NAME: MUHAMMAD ABDULLAH (FALAK)
DEPARTMENT: COMPUTING
SECTION: BSCS 4TH C
ROLL # 13961
DATABASE SYSTEMS
SIR. MUHAMMAD USMAN
1. Create a database with your name and add the following table. Also add another column
name salary in this table. And at last drop the table and database.
QUERY:
create database Abdullah-Falak
create table Salesman
(
customer_id int,
cust_name varchar(50),
city varchar(20),
grade int,
pf3
pf4
pf5
pf8

Partial preview of the text

Download DBMS Basic Excercises and more Quizzes Database Management Systems (DBMS) in PDF only on Docsity!

NAME: MUHAMMAD ABDULLAH (FALAK)

DEPARTMENT: COMPUTING

SECTION: BSCS 4

TH

C

ROLL # 13961

DATABASE SYSTEMS

SIR. MUHAMMAD USMAN

1. Create a database with your name and add the following table. Also add another column

name salary in this table. And at last drop the table and database.

QUERY:

create database Abdullah-Falak create table Salesman ( customer_id int, cust_name varchar( 50 ), city varchar( 20 ), grade int,

salesman_id int, salary int ) insert into Salesman(customer_id,cust_name,city,grade,salesman_id,salary) values( 11 ,'Asif','Multan', 18 , 04 , 27000 ) insert into Salesman(customer_id,cust_name,city,grade,salesman_id, salary) values( 12 ,'Aslam','Sahiwal', 19 , 14 , 49900 ) insert into Salesman(customer_id,cust_name,city,grade,salesman_id, salary) values( 13 ,'Haris','Karachi', 21 , 15 , 23000 ) insert into Salesman(customer_id,cust_name,city,grade,salesman_id, salary) values( 14 ,'Junaid','Mianwali', 22 , 16 , 26000 ) insert into Salesman(customer_id,cust_name,city,grade,salesman_id, salary) values( 15 ,'Raheel','Multan', 21 , 17 , 42000 ) select * from Salesman Drop table Salesman SCREENSHOT:

state varchar( 20 ), state_number varchar( 20 ) ) insert into Stations(id,city,state,state_number) values ( 0012 ,'Faisalabad','pakistan','0649400141') select * from Stations SCREENSHOT:

3. Create a table EMPLOYEE with following attributes: (Emp_no, E_name, E_address,

E_ph_no, Dept_no, Dept_name, Job_id , Salary).

a. Add a new column; HIRE_DATE to the existing relation.

b. Change the datatype of JOB_ID from char to varchar2.

c. Change the name of column/field Emp_no to E_no.

d. Modify the column width of the job field of emp table.

e. Delete the column Salary and Add new column Sal

QUERY: create database EMPLOYEE create table EMPLOYEE ( Emp_no int, E_name varchar( 20 ), E_address varchar( 20 ), E_ph_no varchar( 20 ), Dept_no int, Dept_name varchar( 20 ), Job_id int, Salary int ) insert into EMPLOYEE(Emp_no,E_name,E_address,E_ph_no,Dept_no,Dept_name,Job_id,Salary) values ( 23 ,'Arif','Faisalabad','03344414954', 04 ,'BSCS', 07 , 43000 ) insert into EMPLOYEE(Emp_no,E_name,E_address,E_ph_no,Dept_no,Dept_name,Job_id,Salary) values ( 24 ,'Farhan','PAEC D.G.Khan','032465885947', 05 ,'BSIT', 08 , 31000 ) SELECT * FROM EMPLOYEE SCREENSHOT:

QUERY:

alter table EMPLOYEE

drop column salary

SCREENSHOT: QUERY:

alter table EMPLOYEE

add sal int

SCREENSHOT: