Database Systems: Creating and Managing Tables and Records, Assignments of Database Management Systems (DBMS)

Instructions and SQL queries for creating and managing tables and records in a database system. The examples include creating tables named 'Employee', 'station', 'CATEGORIES', 'CUSTOMERS', and 'PRODUCTS', and inserting records into each table. The document also demonstrates deleting a table and updating records.

Typology: Assignments

2019/2020

Uploaded on 11/17/2021

abdullah-falak
abdullah-falak 🇵🇰

8 documents

1 / 11

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
NAME: MUHAMMAD ABDULLAH (FALAK)
DEPARTMENT: COMPUTING
SECTION: BSCS 4TH C
ROLL # 13961
DATABASE SYSTEMS
SIR. MUHAMMAD USMAN
1. Create a database with your name and add the following table.
1. After Creating table insert at least 10 records of your own choice.
After inserting records delete the table.
QUERIES:
create database Abdullah_Falak
create table Employee
(
customer_id int,
cust_name varchar(50),
city varchar(20),
grade int,
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Database Systems: Creating and Managing Tables and Records and more Assignments Database Management Systems (DBMS) in PDF only on Docsity!

NAME: MUHAMMAD ABDULLAH (FALAK)

DEPARTMENT: COMPUTING

SECTION: BSCS 4

TH

C

ROLL # 13961

DATABASE SYSTEMS

SIR. MUHAMMAD USMAN

1. Create a database with your name and add the following table.

1. After Creating table insert at least 10 records of your own choice.

After inserting records delete the table.

QUERIES:

create database Abdullah_Falak create table Employee ( customer_id int, cust_name varchar( 50 ), city varchar( 20 ), grade int,

Employee_id int ) insert into Employee(customer_id,cust_name,city,grade,Employee_id) values( 11 ,'Asad','Multan', 20 , 33 ) insert into Employee(customer_id,cust_name,city,grade,Employee_id) values( 12 ,'Anas','Lahore', 22 , 34 ) insert into Employee(customer_id,cust_name,city,grade,Employee_id) values( 13 ,'Haris','Islamabad', 23 , 35 ) insert into Employee(customer_id,cust_name,city,grade,Employee_id) values( 14 ,'Mazz','Pindi', 24 , 36 ) insert into Employee(customer_id,cust_name,city,grade,Employee_id) values( 15 ,'Faheem','Sargoda', 25 , 37 ) select * from Employee Drop table Employee

SCREENSHOT:

2. Create the table STATION with a few rows having following values:

INSERT INTO STATION (ID, CITY, STATE, STATE NUMBER)

3. Create a database of shop and add the following tables with the following records.

1. INSERT INTO CATEGORIES (category_id, category name)

VALUES

(25, 'Deli')

(50, 'Produce')

(75, 'Bakery')

(100, 'General Merchandise')

QUERIES:

create database shop create table CATEGORIES ( category_id int, categoryname varchar( 20 ) ) INSERT INTO CATEGORIES (category_id, categoryname) VALUES ( 25 , 'Deli') INSERT INTO CATEGORIES (category_id, categoryname) VALUES( 50 , 'Produce') INSERT INTO CATEGORIES (category_id, categoryname) VALUES( 75 , 'Bakery') INSERT INTO CATEGORIES (category_id, categoryname) VALUES( 100 , 'General Merchandise')

SCREENSHOT:

2. INSERT INTO CUSTOMERS (customer_id, last_name, first_name, favorite_website)

VALUES

(4000, 'Jackson', 'Joe', 'techonthenet.com');

(5000, 'Smith', 'Jane', 'digminecraft.com');

(6000, 'Ferguson', 'Samantha', 'bigactivities.com');

(7000, 'Reynolds', 'Allen', 'checkyourmath.com');

(8000, 'Anderson', 'Paige', NULL);

(9000, 'Johnson', 'Derek', 'techonthenet.com');

QUERIES:

create table CUSTOMERS ( customer_id int, last_name varchar( 20 ), first_name varchar( 20 ), favorite_website varchar( 30 ) ) INSERT INTO CUSTOMERS (customer_id, last_name, first_name, favorite_website) VALUES( 4000 , 'Jackson', 'Joe', 'techonthenet.com') INSERT INTO CUSTOMERS (customer_id, last_name, first_name, favorite_website) VALUES( 5000 , 'Smith', 'Jane', 'digminecraft.com') INSERT INTO CUSTOMERS (customer_id, last_name, first_name, favorite_website) VALUES( 6000 , 'Ferguson', 'Samantha', 'bigactivities.com') INSERT INTO CUSTOMERS (customer_id, last_name, first_name, favorite_website) VALUES( 7000 , 'Reynolds', 'Allen', 'checkyourmath.com') INSERT INTO CUSTOMERS (customer_id, last_name, first_name, favorite_website) VALUES( 8000 , 'Anderson', 'Paige',Null) INSERT INTO CUSTOMERS (customer_id, last_name, first_name, favorite_website) VALUES( 9000 , 'Johnson', 'Derek', 'techonthenet.com')

SCREENSHOT:

SCREENSHOT:

4. INSERT INTO SUPPLIERS (supplier_id, supplier_name, city, state)

VALUES

(100, 'Microsoft', 'Redmond', 'Washington’)

(200, 'Google', 'Mountain View', 'California');

(300, 'Oracle', 'Redwood City', 'California');

(400, 'Kimberly-Clark', 'Irving', 'Texas');

(500, 'Tyson Foods', 'Springdale', 'Arkansas');

(600, 'SC Johnson', 'Racine', 'Wisconsi)

(700, 'Dole Food Company', 'Westlake Village', 'California');

(800, 'Flowers Foods', 'Thomasville', 'Georgia')

(900, 'Electronic Arts', 'Redwood City', 'California')

QUERIES:

create table SUPPLIERS (

supplier_id int, supplier_name varchar( 20 ), city varchar( 20 ), state varchar( 20 ) ) INSERT INTO SUPPLIERS (supplier_id, supplier_name, city, state) VALUES( 100 , 'Microsoft', 'Redmond', 'Washington') INSERT INTO SUPPLIERS (supplier_id, supplier_name, city, state) VALUES( 200 , 'google' , 'Mountain View', 'California') INSERT INTO SUPPLIERS (supplier_id, supplier_name, city, state) VALUES( 300 , 'Oracle', 'Redwood City', 'California') INSERT INTO SUPPLIERS (supplier_id, supplier_name, city, state) VALUES( 400 , 'Kimberly-Clark', 'Irving', 'Texas') INSERT INTO SUPPLIERS (supplier_id, supplier_name, city, state) VALUES( 500 , 'Tyson Foods', 'Springdale', 'Arkansas') INSERT INTO SUPPLIERS (supplier_id, supplier_name, city, state) VALUES( 600 , 'SC Johnson', 'Racine', 'Wisconsi') INSERT INTO SUPPLIERS (supplier_id, supplier_name, city, state) VALUES( 700 , 'Dole Food Company', 'Westlake Village', 'California') INSERT INTO SUPPLIERS (supplier_id, supplier_name, city, state) VALUES( 800 , 'Flowers Foods', 'Thomasville', 'Georgia') INSERT INTO SUPPLIERS (supplier_id, supplier_name, city, state) VALUES( 900 , 'Electronic Arts', 'Redwood City', 'California')

SCREENSHOT:

QUERIES:

delete from CATEGORIES where category_id= 75 update CUSTOMERS set first_name='Jhon' where customer_id= 7000 ALTER TABLE PRODUCTS DROP COLUMN product_price; alter table PRODUCTS ADD discount int update PRODUCTS set product_name='alex' where product_id= 7

SCREENSHOT: