0% found this document useful (0 votes)
4 views4 pages

DBMS lab

Uploaded by

aryan456bhatia
The document outlines a practical lab exercise for creating and managing an employee database using SQL. It includes steps for creating a database, creating a table, inserting, updating, and deleting records, as well as querying for specific data such as net salary. Each step is accompanied by syntax examples to guide users through the process.

Copyright:

© All Rights Reserved

Available Formats

Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
4 views4 pages

DBMS lab

Uploaded by

aryan456bhatia
The document outlines a practical lab exercise for creating and managing an employee database using SQL. It includes steps for creating a database, creating a table, inserting, updating, and deleting records, as well as querying for specific data such as net salary. Each step is accompanied by syntax examples to guide users through the process.

Copyright:

© All Rights Reserved

Available Formats

Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 4

DBMS lab

Pratical-1
Case study-1
Employee database- 'Create' Empolyee_table ,'Select' and Display an employee matching a
given condition, 'Delete' duplicate record, Delete rows using Triggers, Insert and update
records, Find net salary etc.

--

Step-1 Create the database employee in SQL

Syntax-CREATE DATABASE <database_name>;

EX-create database EMPLOYEES;

Step-2 Create table employees Details in the EMPLOYEES database.

Syntax-CREATE TABLE<table_name>(

<Column_name 1><data_type>[(SIZE)]

<Column_name 2><data_type>[(SIZE)]

<Column_name 3><data_type>[(SIZE)]

1
EX-create table Employees (Emp_id int(11),Emp_name varchar(25),Job_name
varchar(25),Manager_id int(11),Hire_date Date, Salary int(11),Commission int(11),Dept_id
int(11))

Step-3 To verify that the table has been created, SHOW TABLES

+--------------------+

| Tables_in_employee |

+--------------------+

| employee |

| employees |

+--------------------+

Step-4 Viewing Table Structure

To View a table structure, DESCRIBE OR desc commands is used

Step-5 Inserting Data into in table

Syntax- INSERT INTO table_name values (values1, values2 , values3);

Example- insert into Employees values("202201","vivek","President","19011","2024-11-


29","98000","900","10012");

Step-6 Checking the table values

Syntax- SELECT* FROM table_name;

EX-select*from Employees;

2
step-7 Updating the values

To modify data in table or to make changes for some or all of the values in the exiting records in
a table, we use the Update Statement.

Syntax- UPDATE<table_name>

SET<column1> = <values1>,<column2>,=values2

WHERE <column_name> = <new_values>;

Ex- UPDATE Employees set salary=1000000 where Emp_name= 'vivek';

step8- Delete Statement

There statement help to delete the duplicate or the defect row from it .

SYNTAX- DELETE FROM <table_name> where conditons;

EX-DELETE FROM Employees where Emp_id='212121';

3
Step9- Find the net salary of Employee

Syntax- SELECT <column_name1>,<colum_name2> , round(<column_name3>/12,2) from


<table_name>;

EX-select Emp_id, Emp_name, round(Salary/12,2) from Employees;

You might also like