0% found this document useful (0 votes)
12 views8 pages

Dbms Lab

Uploaded by

Midhun Manoj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views8 pages

Dbms Lab

Uploaded by

Midhun Manoj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

QUESTION - 1

PART A.

a) Create a table supplier with attributes s_id, s_name, address, city, country, phn_no. here s_id is
the primary key, all other fields must be not null.

b) Display the description of the table.

c) insert 5 records to the table

d) Display the values of the table

PART B

e) update phn_no of a supplier

f) Alter table with add (add a column salary to the supplier)

g) Drop the column salary from supplier

h) Modify the columns_name with varchar(10)to varchar(15)

i) Rename the table supplier to supplier master

j) drop the table

QUESTION - 2

PART A ,

A. create table student with following details;

Field datatype constrains

s_id varchar(15) primary key

s_name varchar(10) cannot be null

Address varchar (50)

Mark numeric (2) must be > 50

B, insert 5 rows into the table

C, display table
D, display the details of student where name starts with A.

E, display the details of students where name end with D.

F, display the S_ID name whose name has U in the 3rd position.

PART B

G, find the sum of marks.

H, List the name of students with 6 characters.

I, find the number of students in the table.

J, find the average mark of the student.

K, find the details of the student who has maximum mark.

L, find the details of the student who has minimum mark.

M, find the details of the student based on their marks in ascending order.

N, find the details of the student based on their marks in descending order.

O, find the names of student whose mark is > avg mark.

P, find the maximum mark from table.

Q, find the minimum mark from table.

R, truncate the table.

QUESTION – 3

PART A

A, Create a table named customer with field C_NO, C_NAME, PHN_NO, LOCATION.

B, insert 5 rows into the table.

C, select C_NO where the C_NAME= ANITHA or the location = Alappuzha.

D, find the C_NO of the customer having name=Anita and location is Kottayam.

E, find the name of customer where location is not Palakkad.

PART B

F, display the C_NAME from customer table where C_NO is in between one & three.
G, find the C_NAME from customer table where C_NO is not in between 1 & 3.

H, find the C_NAME of the customer whose location in Alappuzha or Kottayam.

i)Drop the table

j)Find the square root of25 using dual

k)display todays date.

QUESTION - 4

PART A,

CREATE TABLE CUSTOMER WITH THE FOLOWING DETAILS:

FIELD DATATYPE CONSTRAINTS

CUST_ID VARCHAR (5) PRIMARY KEY SHOULD STARTS WITH


'C'

CUST_NAME VARCHAR (10) CANNOT BE BLANK

REVENUE NUMERIC (15) CANNOT BE BLANK

CUST_TYPE VARCHAR (10) MUST BE EITHER MANUFCTURER,


RETAILER, AGENT, WHOLESALER

B, Insert 3 set of values into the customer.

C, Display the contents of the table.

PART B

a) Add the fields ORDER_ID, PRICE TO THE ABOVE TABLE

b) Insert three values into the table.


C) Display the table orders.

D) Display the number of customer.

E) Find the minimum order price.

F) Find the customer name who have the highest order price.

G) Find the order details of customer who have minimum order price.

QUESTION – 6

PART A

A, Find the absolute value of -45.

B, Find the square root of 225.

C, Find the value of 10^2.

D, Find the remainder of 11/5.

E, Round the number 42.6 to the nearest integer.

F, round the number 98.2 up.

G, Round the number 98.2 down.

PART B

Q) Create table customer with field’s id, name, age, city, salary and display the details.

a) Insert 4 rows into the table.

b) Display the table customer.


c) Find the average of salary.

d) Display the details of customer whose salary greater than average salary of all.

e) Find the maximum salary.

f) Display the details of customer who have highest salary.

QUESTION – 8

Part A

Q) Create table student with field’s id, first name, last name, age, mark and display the details.

a) Insert 4 rows into the table.

b) Display the table student.

C)FIND THE SUM OF MARKS

d)Find the Average of students mark

Part B

c) Create a view student view with field id, first name, and mark.

d) Display the view student view.

e) Update the mark of student using view.

f) Destroy student view.

QUESTION – 9

PART A

Q) Create table employee with field’s employee id, employee name, dept id, salary and display the
details.

a) Insert 5 rows into the table.

b) Display the table employee.

c) Find the dept_id and average of salary of employee in a particular department.


d) Find dept_id and average ( salary) from employee in a particular department who have average
salary greater than 8000.

Part B

Q1) Create table employee with field’s emp_no, emp name, dob, salary .

Q2) Create table department with field’s dep_no, dep name, emp_no .

a) Display all the details from the table employee and department.

b) Display names and department of every employee.

c) Combine the two relations employee and department.

QUESTION – 10

Part A

Q) Create table customer with field’s customer id, name, address and display the details.

a) Insert 5 rows into the table.

b) Display the table customer.

c) Create table order with filed o_id , customer id order date.

d) Insert 4 rows into the table and display the table.

part B

e) Find all the records from customer field where there is at least one record in the order table with the
same.

f) ) Find all the records from all customer table where there is no record in the order table with the
same customer id.

QUESTION - 12

Q) Create table employee with field’s first name, last name, designation, salary and date of joining
display the details.

a) Insert 3 rows into the table.


b) Concatenate the first name and date of joining for employee having salary less than 20000

c) Capitalize the first letter of the field first name.

d) Display the names of employees whose salary is greater than 20000 and name must be lower case.

Part B

e) Left pad the designation of the employee table with character ‘*’ the total width should be 14.

f) Right pad the designation of the employee table with character ‘*’ the total width should be 14.

g) Retrieve the first three character of the name from the table employee.

e) Capitalize the first name of the table employee.

QUESTION - 13

Q) Create table employee with field’s emp no, emp name, dob, and salary.

a) Insert 3 rows into the table employee.

Q) Create table department with field’s emp no, dep no and dep name.

b) Insert 3 rows into the table department.

Part B

c) Display the 2 tables together.

d) D)display the names of dept.of every employee

e) Inner join the two relations


.

You might also like