0% found this document useful (0 votes)
20 views

Practic Le 2

The document describes creating and populating multiple tables in a database. It includes creating tables for jobs, employees, departments, and managers, and inserting sample data into each table.

Uploaded by

Hamza Ravani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Practic Le 2

The document describes creating and populating multiple tables in a database. It includes creating tables for jobs, employees, departments, and managers, and inserting sample data into each table.

Uploaded by

Hamza Ravani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

PRACTICLE-2

Practical - 2. Create table with underlined attribute as primary key and


insert sample data in tables.

(i) Create Table Job (job_id, job_title, min_sal, max_sal):

Quary:

CREATE TABLE JOB(


job_id VARCHAR(15) PRIMARY KEY,
job_title VARCHAR(30),
min_sal DECIMAL(7,2),
max_sal FLOAT(7,2),
dept_no VARCHAR(10)
);
(ii) Create table Employee (emp_no, emp_name, emp_sal, emp_comm, dept_no):

Quary:

CREATE TABLE EMPLOYEE(


emp_no INT(3) PRIMARY KEY,
emp_name VARCHAR(30),
emp_sal DECIMAL(8,2),
emp_comm DECIMAL(6,1),
dept_no INT,
hire_date DATE
1
Enrollment No: 220280107125 BE 3rd Sem CE,CE Dept,LDCE-A’bad-15
);

(iii) Create table Department(dept_no,dept_name,dept_city):

Query:

CREATE TABLE DEPARTMENT(


dept_no INT(3) PRIMARY KEY,
dept_name VARCHAR(15),
dept_city VARCHAR(15),
manager_no INT(3)
);

(iv) Create table Manager(manager_no, manager_name,emp_no):

Query:

CREATE TABLE MANAGER(


manager_no INT(3) PRIMARY KEY,
manager_name VARCHAR(15),
emp_no INT(3)
);

(v) Insert following values in the table Employee

2
Enrollment No: 220280107125 BE 3rd Sem CE,CE Dept,LDCE-A’bad-15
Query:

INSERT INTO EMPLOYEE VALUES(101,'SMIT',800,NULL,20,"2023-03-15");


INSERT INTO EMPLOYEE VALUES(102,'SNEHAL',1600,300,25,"2021-01-21");
INSERT INTO EMPLOYEE VALUES(103,'ADAMA',1100,0,20,"2000-11-17");
INSERT INTO EMPLOYEE VALUES(104,'AMAN',3000,NULL,15,"1999-12-17");
INSERT INTO EMPLOYEE VALUES(105,'ANITA',5000,50000,10,"2008-03-27");
INSERT INTO EMPLOYEE VALUES(106,'SNEHA',2450,24500,10,"2002-03-31");
INSERT INTO EMPLOYEE VALUES(107,'ANAMIKA',2975,NULL,15,"1995-09-05");

Output:

(vi) Insert following values in the table job.

Query:

INSERT INTO JOB VALUES('IT_PROG','PROGRAMMEER',20000,30000,25);


INSERT INTO JOB VALUES('MK_MGR','MARKETING MANAGER',25000,30000,10);
INSERT INTO JOB VALUES('FI_MGR','FINANCE MANAGER',21000,25000,20);
INSERT INTO JOB VALUES('FI_ACC','AMOUNT',10000,20000,20);
INSERT INTO JOB VALUES('SEL','SALES MEN',6000,10000,15);
INSERT INTO JOB VALUES('COMP_OP','COMPUTER OPERATOR',10000,15000,25);

3
Enrollment No: 220280107125 BE 3rd Sem CE,CE Dept,LDCE-A’bad-15
Output:

(vii) Insert following values in the table dept.

Query:

INSERT INTO DEPARTMENT VALUES(10,'MARKETING','ANDHERI',1011);


INSERT INTO DEPARTMENT VALUES(15,'SELL','VIRAR',1051);
INSERT INTO DEPARTMENT VALUES(20,'FINANCE','VILLEPARLE',1101);
INSERT INTO DEPARTMENT VALUES(25,'IT','ANDHERI',1151);

Output:

(viii) Insert following values in the table manager.

4
Enrollment No: 220280107125 BE 3rd Sem CE,CE Dept,LDCE-A’bad-15
Query:

INSERT INTO MANAGER VALUES(1011,'MARKETING',101);


INSERT INTO MANAGER VALUES(1051,'SELL',105);
INSERT INTO MANAGER VALUES(1151,'FINANCE',115);
INSERT INTO MANAGER VALUES(1101,'IT',110);

Output:

5
Enrollment No: 220280107125 BE 3rd Sem CE,CE Dept,LDCE-A’bad-15

You might also like