100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Class notes

RDBMS slip 3 contains a perfect format of coding

Rating
-
Sold
-
Pages
2
Uploaded on
30-04-2024
Written in
2023/2024

RDBMS stands for Relational Database Management System. It's a type of database management system that organizes data into tables with rows and columns. These systems use structured query language (SQL) for managing and querying data. RDBMSs are widely used in various applications, ranging from simple personal databases to complex enterprise systems, due to their flexibility, scalability, and reliability. Examples include MySQL, PostgreSQL, Oracle Database, and Microsoft SQL Server.

Show more Read less
Institution
Course








Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Course

Document information

Uploaded on
April 30, 2024
Number of pages
2
Written in
2023/2024
Type
Class notes
Professor(s)
Unknown
Contains
All classes

Subjects

Content preview

create table newspaper (name char(20) primary key,language char(20) , publisher
varchar(20) , cost number(5) );
create table cities (pincode number(20) primary key , city char(20), state
char(20));
create table nc (name char(20) references newspaper(name), pincode number(20)
references cities(pincode), dailyr number(20) );

SQL> insert into newspaper values('sakal','marathi','xyz',10);

1 row created.
SQL> insert into cities values(411038,'kothrud','maharashtra');

1 row created.

SQL> insert into nc values('sakal',411038,500);

1 row created.


SQL> create or replace trigger t8
2 before insert on cities
3 for each row
4 Begin
5 if(length(:new.pincode) !=6) then
6 raise_application_error(-20001,'pincode length should be 6');
7 End if;
8 End;
9 /

Output

SQL> insert into cities values(4110367,'pune','Maharashtra');
insert into cities values(4110367,'pune','Maharashtra')
*
ERROR at line 1:
ORA-20001: pincode length should be 6
ORA-06512: at "SYSTEM.T8", line 3
ORA-04088: error during execution of trigger 'SYSTEM.T8'


1)
SQL> CREATE OR REPLACE Procedure tc(ecity IN char)
2 IS
3 tot number;
4 BEGIN
5 select sum(cost) into tot from newspaper,cities,nc where
newspaper.name=nc.name and cities.pincode=nc.pincode and city=ecity;
6 dbms_output.put_line('citiwise total cost of newspapaper='||tot);
7
8 END;
9 /

Procedure created.

SQL> begin
2 tc('pune');
3 end;
4 /
citiwise total cost of newspapaper=230
$7.99
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
siddheshbagul0012

Get to know the seller

Seller avatar
siddheshbagul0012 SBB Alias Appasaheb Jedhe College
Follow You need to be logged in order to follow users or courses
Sold
0
Member since
1 year
Number of followers
0
Documents
3
Last sold
-

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

Frequently asked questions