0% found this document useful (0 votes)
16 views5 pages

DBMS 05

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)
16 views5 pages

DBMS 05

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

EXPERIMENT-05

AIM: Perform data manipulation operations on populated database.


THEORY:
MySQL provides a rich set of data manipulation operations to allow users to retrieve,
insert, update, and delete data from a database. Here are some of the most common
data manipulation operations in MySQL:

1)-SELECT: The SELECT statement retrieves data from one or more tables. It can
be used to retrieve all the data in a table or just a subset of it using a WHERE
clause.

EXAMPLE
To retrieve all data from a table called employees, you can use the following
SELECT statement:
-> SELECT * FROM employees;

2)- INSERT INTO: The INSERT INTO statement adds new rows to a table. It
specifies the values for each column in the new row.

EXAMPLE
To add a new row to the employees table with the name "John Smith" and the email
"[email protected]", you can use the following INSERT INTO statement
->INSERT INTO employees (name, email) VALUES ('John Smith',
'[email protected]');

3)- UPDATE: The UPDATE statement modifies existing data in a table. It can be
used to modify a single row or multiple rows based on a WHERE clause.

EXAMPLE
To update the email address for employee with id 123, you can use the following
UPDATE statement:
->UPDATE employees SET email = '[email protected]' WHERE id = 123;

4)-DELETE FROM: The DELETE FROM statement removes one or more rows from
a table. It specifies the conditions for the rows to be deleted using a WHERE clause.

EXAMPLE
To delete all employees who work in the marketing department, you can use the
following
->DELETE FROM employees WHERE department = 'marketing';
QUERIES ON DML COMMANDS

1)-
insert into client_master values ('C00001', 'Ivan Bayross', 'Bombay', 'Maharashtra', 400054, 15000);
insert into client_master values ('C00002', 'Vandana Saitwal', 'Madras', 'Tamil Nadu', 780001, 0);
insert into client_master values ('C00003', 'Parmada Jaguste', 'Bombay', 'Maharashtra', 400057,
5000);
insert into client_master values ('C00004', 'Basu Navindgi', 'Bombay', 'Maharashtra', 400056, 0);
insert into client_master values ('C00005', 'Ravi Sreedharan', 'Delhi', ' ', 100001, 2000);
insert into client_master values ('C00006', 'Rukmini', 'Bombay', 'Maharashtra', 400050, 0);

SELECT * from client_master;

2)-
insert into product_master values( 'P00001', '1.44 loppies', 5, 'Piece', 100, 20, 525, 500);
insert into product_master values( 'P03453', 'Monitors', 6,'Piece', 10, 3, 12000, 11280);
insert into product_master values('P06734', 'Mouse', 5,'Piece', 20, 5, 1050, 1000);
insert into product_master values( 'P07865', '1.22 Floppies',5, 'Piece', 100, 20, 525, 500);
insert into product_master values('P07868','Keyboards',2,'Piece', 10, 3, 3150, 3050);
insert into product_master values('P07885', 'CD Drive', 2.5, 'Piece', 10, 3, 5250, 5100);
insert into product_master2 values( 'P07965', ' HDD', 4,'Piece', 10, 3, 8400, 8000);
insert into product_master values('P07975', ' Drive', 5,'Piece', 10, 3, 1050, 1000);
insert into product_master values( 'P08865', '1.22 Drive', 5, 'Piece', 2, 3, 1050, 1000);

SELECT * from product_master ;

3)-
insert into salesman_master values('S00001','Kiran','A/14','Worli','Bombay',400002,'MAH',3000,100,50,'Good');
insert into salesman_master
values('S00002','Manish','65','Nariman','Bombay',400001,'MAH',3000,200,100,'Good');
insert into salesman_master values('S00003','Ravi','P-7','Bandra','Bombay',400032,'MAH',3000,200,100,'Good');
insert into salesman_master values('S00004','Ashish','A/5','Juhu','Bombay',400044,'MAH',3500,200,150,'Good');

SELECT * from salesman_master;


4)-
INSERT INTO sales_order values('019001','1996-01-12','C00001','S00001','F','N','1996-01-20','IP');
INSERT INTO sales_order values('019002','1996-01-25','C00002','S00002','P','N','1996-01-27','C');
INSERT INTO sales_order values('046865','1996-02-18','C00003','S00003','F','Y','1996-02-20','F');
INSERT INTO sales_order values('019003','1996-04-03','C00001','S00001','F','Y','1996-04-07','F');
INSERT INTO sales_order values('046866','1996-05-20','C00004','S00002','P','N','1996-05-22','C');
INSERT INTO sales_order values('010008','1996-05-24','C00005','S00004','F','N','1996-05-26','IP');

SELECT * from sales_order;

5)-
insert into sales_order_details values ('019001', 'P00001', 4,4, 525);
insert into sales_order_details values ('019002', 'PO7965', 2,1, 8400);
insert into sales_order_details values ('019003', ' P0785', 2,1, 5250);
insert into sales_order_details values ('019004', 'P00001', 10,0, 525);
insert into sales_order_details values ('019005', 'P07868', 3,3, 3150);
insert into sales_order_details values ('019006', ' P0785', 3,1, 5250);
insert into sales_order_details values ('019007', 'PO0001', 10,10, 525);
insert into sales_order_details values ('019008', 'PO331', 4,4, 1050);
insert into sales_order_details values ('019009', 'PO3453', 2,2, 1050);
insert into sales_order_details values ('019010', 'P06734', 1,1, 12000);
insert into sales_order_details values ('019011', 'P07965', 1,0, 8400) ;
insert into sales_order_details values ('019012', 'PO7975', 1,0, 1050);
insert into sales_order_details values ('019013', 'P00001', 10,5, 525) ;
insert into sales_order_details values ('019014', 'P07975', 5,3, 1050) ;

SELECT * from sales_order_details ;


6)-
insert into challan_header values('CH9001', '019001', '1995-12-12', 'Y');
insert into challan_header values('CH6865', '046865', '1995-11-12', 'Y');
insert into challan_header values('CH3965', '010008', '1995-10-12', 'Y');

SELECT * from challan_header ;

7)-
insert into challan_details values('CH9001', 'P00001', 4);
insert into challan_details values('CH9001', 'P07885', 1);
insert into challan_details values('CH6865', 'P07868', 3);
insert into challan_details values('CH6865', 'P03453', 4);
insert into challan_details values('CH6865', 'P00001', 10);
insert into challan_details values('CH3965', 'P00001', 5);
insert into challan_details values('CH3965', 'P07975', 2);

SELECT * from challan_details ;

CONCLUSION: We have implemented DML commands in MySQL Queries and learnt how it is used
to manipulate and render database.

You might also like