You are on page 1of 6

Create Worker table with following attribute: (Worker_id, First_Name, Last_Name, Salray, Joining_Date,

Department).

Create Job_Title table with following attribute : (Worker_ref_id,Worker_desig) ) where Worker_ref_id


should be the foreign key of Worker_id of Worker table)

1. If the user has not entered the department name for any of the record, it should fetch the
default value as ‘PENDING’.
2. Delete record of all those employees whose salary is below 25000.
3. Display first_name, worker_id, salary of all those employees whose salary is greater than 50000.

Create table Sales with following attribute: (SalesID, Password), such that no two user have same
SalesId.

Create table Marketing with following attribute : (SalesID, Salesman_name, ProductID,ProductName,


Price), where SalesID is the foreign key of the SalesID of Sales table.

1. Display the Salesman_name, SalesID and password of all those salesmen whose product price is
greater than 2000.
2. Display the ProductID of all those product whose price is greater than 500.

Create a table student with attributes (Sid, Name, Address, City, course and pending_fee)
and apply the following queries:

a. Change the pending_fee of student as 0 having id 19 and 76.


b. Display out the id, course of id S20 from the Record.
c. Display the Sid and city having character ‘A’ at first position in city.

Write a PL/SQL code to read the values of Product _name, Product_price, Quantity from user. And
display the output in following format:

Product _name Pen

Product _Price 10

Quantity 20 Price of 1 pen is 10 and price of 20 pen is 200.

Write a Pl/SQL to read marks of 3 subjects and print the average marks of three subjects.
e.g. INPUT

Dbms 86

DbmsLab 70
CLanguage
68

OUTPUT

Average marks of 3 subjects is 74.67

Write a query to add 4 character ‘# ‘at the end of given string : ‘Development’.
Input : Development
Output : Development####

Create a table ‘Railways’ with attribute : TrainNo, Passenger_Name, Origin, Destination. Display the
number of passenger travelled to each destination.

Write a query to combine 2nd and 4th column data in single column with Name as ‘details’.

Create Worker table with following attribute: (Worker_id, First_Name, Last_Name, Salray, Joining_Date,
Department)

Create Bonus Table with following attribute : (Worker_ref_id,Bonus_date,Bonus_Amount) where


Worker_ref_id should be the foreign key of Worker_id of Worker table)

1. Apply constraint such that Salary of each employee should be greater than 30000.
2. Update the department as ADMIN, if the worker belongs to HR.
3. Display worker_id of those entire workers who belong to HR Department.

Create table UmsLogin with following attribute: (UserID, Password), such that no two user have same
userId.
Create table UMS_Stud_DB with following attribute : (UserID, username, Department,Branch,
Semester) where UserID is the foreign key of the UserID of UmsLogin table

1. Display the UserId, username of those students who belong to M.Sc Branch
2. Display the UserId , Username,Password, Branch, semester for all those students whose data
are available in Ums_stud_Db table.
3. Display the details of student in sorted order based on UserID.

Consider a following relation and perform the SQL queries:


Employee (Eid, Ename, City, contact number, salary) where Eid is primary key.
Display the Record using following conditions:
a. Find out the record where employee city is Jalandhar and salary is 30000.
b. Change the city to ‘Mumbai’ where city is ‘Bombay’.
c. Display the Eid and Name of those employee whose name end with ‘d’.

Write a PL/SQL code to read the values of Product _name, Product_price, Quantity from user. And
display the output in following format:

Product _name Pen

Product _Price 10

Quantity 20 Price of 1 pen is 10 and price of 20 pen is 200.

Write a Pl/SQL to read any number from user and print the table of that number.

e.g. Input : 5

Output : 5

10

15……..50

Consider a following relation and perform the SQL queries:

Employee (Eid, Ename, City, contact number, salary, DpID) where Eid is primary key and DpID is
foreign key.

Department (Dept_id, Dept_name, No of employees) where Dept_id is Primary key.

Display the Record using following conditions


d. Find out the record where employee city is Delhi and salary is 30000.
e. Display the Average salary of employee.
f. Display the name of the department after adding character ‘#’ to make the length 20 of department id
101.
g. Change the character ‘a’ with character ‘@’ in department name.
h. Combine any two strings with name Result.

Write a Pl/SQL to read any number from user and print the table of that number in reverse order.

e.g. Input : 5

Output : 50

45

40……..5

Write a Pl/SQL to read any number from user and print the table of that number and display the sum of
square of that number.

Write a Pl/SQL to read marks of 3 subjects and calculate the percentage marks and display whether
he/she is PASS or fail

e.g. INPUT

Dbms 86

DbmsLab 70
CLanguage
68

OUTPUT

Percentage = 74.67

PASS
Create an EMP table with following attribute : empno, empname, salary

Create a trigger on the EMP table, which shows the old values and new values after any updation on
salary of EMP table.

Write a PL/SQL code to print the sum of square of 1st 10 natural numbers.

1. Write a query to select the least number from list (500,300,900).


2. Write a query to calculate the length of string ‘Professional Country.
3. Write a query to add 4 character ‘$ at the end of the string ‘ComputerLab’.
4. Write a query using function to display the name in uppercase.
5. Write a query using function to truncate M from start and end position of ‘MADAM’ and
display the output as ADA.

Create a table item_detail with following attribute : (Item_Name, Price)


Write a Query to replace $ with Rs. In price column of item_detail table.
Input : $5010
Output : Rs.5010

Write a query to display the square of 94 and display the result..

Create a table ‘Vehicle’ with attribute : VechileNo, VechileType and OwnerName

Input : 12313, ‘TwoWheeler’,’Rahul’

Write a query to display the number of vehicle of each type.

Create an Course_ table with following attribute : Reg_No,Sud_Name, Course_code, course_name,


marks

Create a trigger on the Student table, which shows the old values and new values after any updation on
marks of Student table.

Write a PL/SQL code to print the sum of 1st 10 natural numbers.

Write a Pl/SQl code to print the sum of cube of 1st 10 natural numbers.
Write a Pl/Sql code to check whether entered number is Armstrong or not.

Write a Pl/Sql code to check whether entered number is Palindrome or not.

Create a table Product master with attributes and perform the following Experiments.

P_id, Product Name, Quantity, Price, and Brand

a. P_id should be unique and also also price of each product should be greater than 50.
b. Write a query to select Product id and name whose price is less from 1500.
c. Write a query to retrieve the Brand name by adding character ‘#’ to make its length 20.
d. Write a query to retrieve the minimum and maximum price.
e. Perform any three string functions on table.
f. Write a query to combine product name and brand in single column.

6. Write a query to select the largest number from list (500,300,900).


7. Write a query to calculate the length of string ‘I Live in India’.
8. Write a query to add 4 character ‘# at the end of the string ‘Professional’.
9. Implement Ceil and Floor functions.
10. Write a query using function to truncate M from start and end position of ‘MADAM’ and
display the output as ADA.