0% found this document useful (0 votes)
10 views9 pages

Sir uzair assignment

The document is a lab manual for Database Systems, detailing SQL commands for creating and managing a database named E_COMMERCE. It includes instructions for creating tables, inserting data, and performing various SQL operations such as SELECT, UPDATE, DELETE, and more. The manual serves as a practical guide for students in the 2nd Semester BS IT-BS DS program.

Uploaded by

s24adit103
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)
10 views9 pages

Sir uzair assignment

The document is a lab manual for Database Systems, detailing SQL commands for creating and managing a database named E_COMMERCE. It includes instructions for creating tables, inserting data, and performing various SQL operations such as SELECT, UPDATE, DELETE, and more. The manual serves as a practical guide for students in the 2nd Semester BS IT-BS DS program.

Uploaded by

s24adit103
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
You are on page 1/ 9

Lab Manual

Database Systems
2nd Semester BS IT- BS DS

Submitted by:
Shahab Baloch
Submitted to:
Sir Uzair
Submitted date:
30-11-2024
1 create database
create database E_COMMERCE;

2 use the database


use E-commerce;

3 SHOW TABLES : list of all table in the current database.


Show tables;

4 SHOW DATABASES: lists all databases on the server.


show databases;

5 CREATE TABLE. Create a new table in database.


create table PRODUCT(product_ld int,name
varchar(70),description varchar(100),price int,stock int,
category varchar(100));
6 INSERT: adds new data to a table.
insert into
product(product_id,name,description,price,stock,category)valu
es(1,'Bag','good',1999,28,'bag');

7 CREATE TABLE: Create a new table in database.


create table customer(customer_id int,name varchar(50),email
varchar(60),address varchar(100),phone int);

8 INSERT: adds new data to a table.


insert into
customer(customer_id,name,email,adress,phone)values(1,'irsh
ad','[email protected]',0333038389);
9 CREATE TABLE: Create a new table in database.
create table orders(order_id int,customer_id int,order_date
int,total_amount int,status varchar(100));

10 INSERT: adds new data to a table.


insert into
orders(order_id,customer_id,order_data,total_amount,status)v
alues(1,1,24_6_2023,3200,'good');

11 CREATE TABLE: Create a new table in database.


create table order_items(order_id int,product_id int,quantity
int,price int);

12 DESCRIBE (OR DESC): show the structure of a table.


desc Order_items;

13 SHOW TABLES: lista of all tables in the current


database.
show tables;

14 SELECT: retrieves data from a table.


select quantity,price from Order_items;

15 UPDATE: modifies existing data in a table.


update Order_items set price=6500 where order_id=2;
16 DELETE: removes data from a table.
delete from Order_items where id=1;

17 ORDER BY : sort the result set.


select*from order_items order by price desc;

18 WHERE CLAUSE: filters data based on conditions.


select*from Order_items where price>6000;

19 ALTER TABLE: modifies the structure of an existing table.


alter table order_items add column feedback varchar(100);

20 LIMIT: restricts the number of rows returned in a result


set.
select*from order_items limit 9;

21 DISTINCT: removes duplicate values from the result set.


select distinct price from order_items;
22 GROUP BY: groups rows that have the same values in
specifie column.
select price, count(*) from order_items group by price;

23 LIKE: searches for a specified pattern in a column.


select*from order_items where product_name like'j%';

24 IN: specifies multiple values in a where clause.


select*from order_items where price in(3000,6000,7000);

25 BETWEEN: select values within a given range.


select*from order_items where price between 6000 and 7000;

26 RENAME TABLE. Change the name of an existing table.


rename table order_items to order_item;
27 TRUNCATE: removes all record from a table, but not the
table
Itself.
truncate table order_item;

28 DROP TABLE: delete a table from the database.


drop table order_item;

29 DROP DATABASE: delete an entire database.


drop database Ecommerce;

30 SELECT: select the all table;


select*from order_item;

You might also like