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.
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 ratings0% 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.
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');
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;