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

DBMS4 - Database Initialization

Dbms

Uploaded by

rithulbgmi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

DBMS4 - Database Initialization

Dbms

Uploaded by

rithulbgmi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

EXP:4

DATABASE INITIALIZATION - Data insert, Data import to a database

Consider the employee database given below


emp (emp_id,emp_name, Street_No, city)
works (emp_id, company name, salary)
company (company name, city)
manages (emp_id, manager_id)

Create table emp


Import the CSV file with the following information:
INSERT INTO emp VALUES('E-101','Adarsh',101,'MG Road');
INSERT INTO emp VALUES('E-102','Bonny',101, 'MG Road');
INSERT INTO emp VALUES('E-103','Catherine', 102, 'Cochin');
INSERT INTO emp VALUES('E-104','Glenn', 104, 'Ernakulam');
INSERT INTO emp VALUES('E-105','George', 201,'MG Road');
INSERT INTO emp VALUES('E-106','Hayes', 101, 'MG Road');
INSERT INTO emp VALUES('E-107','Johnson',102, 'Cochin');
INSERT INTO emp VALUES('E-108','Jones', 101, 'Cochin');
INSERT INTO emp VALUES('E-109','Karthik', 101, 'Ernakulam');
INSERT INTO emp VALUES('E-110','Lavanya', 101, 'Palace Road');
INSERT INTO emp VALUES('E-111','Niharika', 102, 'Ernakulam');
SELECT * FROM emp
Create table company
Import the CSV file with the following information:
insert into company values('SBI','MG Road');
insert into company values('SBT','MG Road' );
insert into company values('Federal',’Broadway’);
insert into company values('Indian Bank', 'Cochin');
insert into company values('SIB', 'Ernakulam');
insert into company values('HDFC', 'Palace Road');
insert into company values('Axis', 'Cochin');
insert into company values('City bank', 'Ernakulam'); 30

Import the CSV file with the following information:


Create table works
insert into works values('E-101','SBI',71000);
insert into works values('E-102','SBI',90000);
insert into works values('E-103','SBT',40000);
insert into works values('E-104','Federal',37000);
insert into works values('E-105', 'SBT',17000);
insert into works values('E-106','Indian Bank',30000);
insert into works values('E-107', 'SIB',21000);
insert into works values('E-108','SIB',18000);
insert into works values('E-109', 'Indian Bank',28000);
insert into works values('E-110','SBT',250000);
insert into works values('E-111', 'Federal',40000);
Import the CSV file with the following information:
Create table works manages
insert into manages values('E-101', 'E-102');
insert into manages values('E-102', Null);
insert into manages values('E-103', 'E-110');
insert into manages values('E-104', 'E-111');
insert into manages values('E-105', 'E-110');
insert into manages values('E-106', 'E-109');
insert into manages values('E-107', Null);
insert into manages values('E-108', Null);
insert into manages values('E-109',Null);
insert into manages values('E-110', Null);
insert into manages values('E-111', null);

RESULT:

Data import and insert to the database is done successfully.

You might also like