Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

RDBMS LAB PROGRAMS

Rating
-
Sold
-
Pages
36
Uploaded on
22-12-2023
Written in
2023/2024

THIS FILE CONTAIN RDBMS LAB PROGRAMS, SQL AND PL/SQL.

Institution
Course

Content preview

Ex.No :01

Date:


Query Processing: 01
AIM:
To Create a table student master with the following fields name, regno, department and year with
suitable data types. Use select command to do the following

a) Select the students’s name column

b) Eliminate the duplicate entry in table

c) Sort the table in alphabetical order

d) Select all the students of a particular department

Procedure:
SQL> create table student_master(regno number(20) primary key,name varchar(20),dept
varchar(20),year number(4));

Table created.

SQL> select * from student_master;

no rows selected

SQL> insert into student_master values(101,'Gulam','Bsc.Cs',2011);

1 row created.

SQL> insert into student_master values(102,'Faisal','Bsc.IT',2012);

1 row created.

SQL> insert into student_master values(103,'Umar','B.com',2013);

1 row created.

SQL> insert into student_master values(104,'Yasar','B.A Eng',2014);

1 row created.

SQL> insert into student_master values(105,'Afridi','Bsc.che',2015);

1 row created.



1

,a) Select the students’s name column
SQL> select name from student_master;

NAME

--------------------

Gulam

Faisal

Umar

Yasar

Afridi

b) Eliminate the duplicate entry in table
Create the primary key during the time of table creation

c) Sort the table in alphabetical order
SQL> select * from student_master order by name;

REGNO NAME DEPT YEAR

---------- -------------------- -------------------- ----------

105 Afridi Bsc.che 2015

102 Faisal Bsc.IT 2012

101 Gulam Bsc.Cs 2011

103 Umar B.com 2013

104 Yasar B.A Eng 2014

d) Select all the students of a particular department
SQL> select * from student_master where dept='Bsc.Cs';

REGNO NAME DEPT YEAR

---------- -------------------- -------------------- ----------

101 Gulam Bsc.Cs 2011




2

,Ex.No :02

Date:


Query Processing: 02
AIM:
To Create a table sales_order with sorderno,productno as primary key set other

field to clientno,delivery_data,order status.




a) add a new column for starting a salesman number using alter command.

b) set sorderno as foreign key as columnconstrains.

c) set the sorderno as foreign key as tableconstrains.



Procedure:
SQL> create table sales(sorderno number(20),prodno number(20)primary key);

Table created.




SQL> create table delivery( deliveryno number(20), delivery_add varchar(20),

delivery_data date);

Table created.




a) add a new column for starting a salesman number using alter command.

3

, SQL> alter table sales add(salesmanno number(20));

Table altered.



SQL> desc sales;



Name Null? Type

----------------------------------------- -------- -----------------------

SORDERNO NUMBER(20)

PRODNO NOT NULL NUMBER(20)

SALESMANNO NUMBER(20)



b) set sorderno as foreign key as column constrains.



SQL> alter table delivery add(delno number(20)primary key);

Table altered.



SQL> desc delivery;

Name Null? Type

----------------------------------------- -------- -----------------------

DELIVERYNO NUMBER(20)

DELIVERY_ADD VARCHAR2(20)

DELIVERY_DATA DATE

DELNO NOT NULL NUMBER(20)




c) set the sorderno as foreign key as table constrains.


4

Written for

Course

Document information

Uploaded on
December 22, 2023
Number of pages
36
Written in
2023/2024
Type
Class notes
Professor(s)
B.v.saravanan
Contains
All classes

Subjects

$8.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
bvsaravanangacpmk

Get to know the seller

Seller avatar
bvsaravanangacpmk Alagappa University Affliated Colleges Karaikudi
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
2 year
Number of followers
0
Documents
10
Last sold
-
IT STUDENTS DOCUMENTS

THIS SHOP CONTAINS ALL IT RELATED NOTES AND PRACTICAL NOTE WILL BE AVAILABLE.

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions