You are on page 1of 5

Assignment no :- 1 Name:- MD Akbar ali

Class:- BCA Roll no :- 3180/22

2. University Database E-R diagram


Assignment no :- 1 Name:- MD Akbar ali
Class:- BCA Roll no :- 3180/22

3. Online Shopping System E-R diagram


Assignment no :- 1 Name:- MD Akbar ali
Class:- BCA Roll no :- 3180/22

5. Perform Following SQL queries:-


a) Create table employee15(name, id, salary, age, department, address, position)
Input:-
CREATE TABLE employee15(
First_name char(20),
Last_name char(20),
Id INT PRIMARY KEY,
salary integer,
age integer,
department char(20),
address char(20),
position char(20)
);
Output:-

b) Insert atleast 10 entries to table.


Input:-

INSERT INTO employee15(First_name, Last_name, id, salary, age, department, address, position)
VALUES
(‘Md’, ‘Akbar’, 1, 150000, 21, ‘HR’, ‘Punjab’, ‘Manager’),
(‘Arzo, ‘Raza, 2, 70000, 50, ‘IT, ‘Delhi, ‘Developer’),
(‘Ritik, ‘Kumar, 3, 48000, 40, ‘IT’, ‘Gurugram, ‘Engineer’),
(‘Sumit, ‘Kumar, 4, 45000, 40, ‘IT’, ‘Punjab, ‘Data Scien0st’),
(‘Nagma, ‘Parveen, 5, 78000, 20, ‘IT’, ‘Rajasthan, ‘Cyber Expert’)
('Payal',' Kumari', 6, 80000, 40, 'IT', 'Old delhi', 'Developer'),
('Saurabh ','Rajput', 7, 15000, 50, 'IT', 'Jammu', 'Team Leader'),
('Ratan',' Mishra', 8, 25000, 45, 'IT', 'Odisha', 'Developer'),
('Divesh',' Das', 9, 42000, 26, 'IT', 'Delhi', 'Assistant Manager'),
('Kundan ','Sukla', 10, 12000, 43, 'MarkeƟng', 'Bihar', 'Coordinator');
Output:-

c) Retrieve all columns from a table named “employees”.


Input:-
SELECT * FROM employee15;
Output:-
Assignment no :- 1 Name:- MD Akbar ali
Class:- BCA Roll no :- 3180/22
d) Retrieve only the “fiest_name” and “last_name” columns from the “employees” table.
Input:-
SELECT First_name, Last_name From employee15;
Output:-

e) Filter rows from the “Products” table where the “price” is greater than 50
CREATE TABLE pruducts1(
Product_id INTEGER PRIMARY KEY,
Product_name CHAR(25),
Price INTEGER
);
INSERT INTO products1(product_id product_name , price)
VALUES
(1, 'APPLE', 45),
(2, 'BANANA', 60),
(3, 'SOAP', 30),
(4, 'MANGO', 75),
(5, 'ONION', 25);
SELECT * FROM products WHERE price > 50;
Assignment no :- 1 Name:- MD Akbar ali
Class:- BCA Roll no :- 3180/22

f) Add new column to existing table (phone_no.)

ALTER TABLE products


ADD COLUMN phone_no integer;
SELECT * FROM products ;

You might also like