0% found this document useful (0 votes)
2 views

internal

The document outlines the creation of several database tables related to a library system, including tables for publishers, books, authors, library programs, book copies, cards, and book lending. It includes the structure of each table, specifying primary and foreign keys, as well as data types. Additionally, it provides sample insert statements for adding publishers and books to the database.

Uploaded by

gangambika
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

internal

The document outlines the creation of several database tables related to a library system, including tables for publishers, books, authors, library programs, book copies, cards, and book lending. It includes the structure of each table, specifying primary and foreign keys, as well as data types. Additionally, it provides sample insert statements for adding publishers and books to the database.

Uploaded by

gangambika
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

create table publisher

(
name varchar(20) primary key,
address varchar(20),
phone number(20)
);

create table book


(
book_id number(10) primary key,
title varchar(20),
publisher_name varchar(20),
foregin key(publisher_name) references publisher(name) on delete cascade,
pub_year varchar(20)
);

create table book_authors(


book_id number(10),
author_name varchar(20),
primary key(book_id,author_name),
foreign key (book_id) references book(book_id) on delete cascade
);

create table library_programme


(
programme_id number(10) primary key,
programme_name varchar (10),
address varchar(100)
);

create table book_copies


(
no_of_copies number(5),
book_id number(10),
programme_id number(10),
primary key(book_id,programme_id),
foregin key(book_id) references book(book_id) on delete cascade,
foregin key(programme_id) references library_programme(programme_id) on delete
cascade
);

create table card


(
card_no number(10) primary key
);

create table book_lending


(
date_out date,
due_date date,
book_id number(10),
programme_id number(10),
card_no number(10),
primary key(book_id,programme_id,card_no),
foregin key(book_id) references book(book_id) on delete cascade
foregin key(programme_id) references library_programme(programme_id) on delete
cascade
foregin key(card_no) references card(card_no) on delete cascade
);
insert into publisher values('john','banglore','9845074074');
insert into publisher values('ravi','manglore','9841074074');
insert into publisher values('ram','chennai','8841074074');
insert into publisher values('sam','hassan','9841074073');
insert into publisher values('kiran','udupi','9841074076');

insert into book values(2,'dbms',john','jan-2017');


insert into book values(3,'cn',ravi','jan-2016');
insert into book values(2,'dbms',john','jan-2017');

You might also like