0% found this document useful (0 votes)
2 views2 pages

MySQL Database and Table Creation Guide

The document contains MySQL commands for creating and managing a database with two tables: 'department_info' and 'employee_info'. It includes commands for defining the structure of the tables, inserting data into them, and establishing a foreign key relationship. Several records are inserted into both tables to represent departments and employees.

Uploaded by

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

MySQL Database and Table Creation Guide

The document contains MySQL commands for creating and managing a database with two tables: 'department_info' and 'employee_info'. It includes commands for defining the structure of the tables, inserting data into them, and establishing a foreign key relationship. Several records are inserted into both tables to represent departments and employees.

Uploaded by

kulnoor.kaur
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

MySQL-3

Queries
Show databases;
Use kulnoor;
create table department_info(dept_ID varchar(5) primary key,dept_name
varchar(15),dept_location varchar(10),dept_budget int);

create table employee_info(emp_ID varchar(5) primary key,emp_name varchar(15),emp_dob


date,emp_city varchar(15),dept_ID varchar(5),foreign key(dept_ID) references
department_info(dept_ID));

desc department_info;

desc employee_info;

insert into department_info values('101','IT','FC-89',500000);


insert into department_info values('102','Electronics','FC-54',400000);
insert into department_info values('103','Admin','TY-56',350000);
insert into department_info values('104','Accounts','TY-43',250000);

insert into employee_info values('SL21','Sana','1978-04-30','Delhi','101');


insert into employee_info values('PL67','Aayush','1992-03-01','Delhi','101');
insert into employee_info values('HG56','Dawid','1987-07-25','Kanpur','103');
insert into employee_info values('NF78','Nishank','1996-11-19','Prayagraj','104');
insert into employee_info values('FR32','John','1989-08-03','Delhi','104');

Output

You might also like