Databse Management System

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

DATABASE MANAGEMENT SYSTEM

MODLE QUESTION PAPER

1. Create table ART_OBJECT,PAINTING and STATUE as per the following schema:


 ART_OBJECT

ID_NO Artist_Name Year_created Title Art_type Description

 PAINTING
Paint_Type Base_Materials Style Price

 STATUE
Material_Type Height Weight Style Price

2. Insert Records into the Above Tables


3. Queries to be executed
 Retrive The details Of the Costliest painting using nested queries
 Retrive the names of the artist who have worked on Abstract style
 Delete all the records pretaining to the artist by name “Sahithya”

Creating Tables
DATABASE MANAGEMENT SYSTEM

Art_Object

Create table art_object(id_no int,artist_name varchar(19),year_created char(10),title


varchar(15),art_type varchar(15),description varchar(35),primary key(title))engine=innodb;

Painting

Create table painting(paint_type varchar(19),base_material varchar(15),style varchar(15),price


decimal(10,3),foreign key(style) references art_object(tittle))engine=innodb;

Statue

Create table statue(material_type varchar(15),height int,weight int,style varchar(15),price


decimal(10,3),foreign key(style) references art_object(title))engine=innodb;

Inserting Values

>insert into art_object values(1,’sahitya’,’1999’,’modren’,’painting’,’it is a modern type of


painting’);

>insert into art_object values(2,’karthik’,’2000’,’abstract’,’painting’,’it is a abstract type of


painting’);

>insert into art_object values(3,’likith’,’2001’,’abstract1’,’statue’,’it is a abstract type of statue’);

>insert into art_object values(4,’darshan’,’1998’,’modren1’,’statue’,’it is a modern type of


statue’);

>insert into painting values(‘oil’.’paper’,’modren’,20000);

>insert into painting values(‘water’.’canvas’,’abstract’, 21000);

>insert into painting values(‘organic’.’wood’,’abstract’,19000);

>insert into painting values(‘crayon’.’fiber’,’modren1’,22000);

>insert into statue values(‘tyoe’,65500,’modren’,19000);

>insert into statue values(‘stone’,50500,’abstract’,20000);


DATABASE MANAGEMENT SYSTEM

>insert into statue values(‘glass’,70500,’abstract1’,21000);

>insert into statue values(‘wood’,55500,’modren1’,22000);

Tables

Art_Object

>select * from art_object

Id_no artist_name Year_created Title Art_type description


1 sahitya 1999 modern painting It is a modern
type of
painting
2 karthik 2000 abstract painting It is a abstract
of painting
3 likith 2001 abstract1 statue It is a abstract
type of statue
4 darshan 1998 modern1 statue It is a modern
type of statue

Painting

>select * from painting


DATABASE MANAGEMENT SYSTEM

Paint_type Base_material style price


oil paper modern 20000
water canvas abstract 21000
organic wood abstract 19000
crayon fiber modern 22000

Statue

>select * from statue

material_type height weight style price


tyoe 65 500 modren 19000
stone 50 500 abstrect 20000
glass 70 500 Abstract1 21000
wood 55 500 Modren1 22000

Queries
Retrieve the names of the artist who have worked on abstract style

>select artist_name

>from art_object a,painting p

>where style=’abstract’ and a.title=p.style;

Artist_name

karthik

Retrieve the price of the painting have the base material as fiber and its paint type as water

>select price
DATABASE MANAGEMENT SYSTEM

>from painting

>where base_material=’fiber’ and paint_type=’water’;

price
22000
21000

Delete all the records pretaining to the artist by name “Sahithya”

>delete from art_object

>where artist_name=’sahitya’;

Query ok 5 rows affected(0.05sec)

Retrieve id_no,artis name,year created and order by year created

>select id_no,artist_name,year_created

>from art_object

>where id_no>1

>order by year_created;

Id_no Artist_name Year_created


4 darshan 1998
2 karthik 2000
3 likith 2001

Create view paint_info consisting of id no, artist name, paint type, price

>create view paint_info as


DATABASE MANAGEMENT SYSTEM

>select id_no,artist_name,paint_type,price

>from art_object, painting p

>where a.title=p.style;

Id_no Artist_name Paint_type Price


1 Sahitya Modern 20000
2 Karthik Abstract 21000
3 Likith Abstract 19000
4 darshan modren 22000

Change the artist name to Ibrahim of id no 1

>update art_object

>set artist_name=’ibrahim’

>where id_no=1;

Row matches :1 changed :1 warning: 0

>select * from art_object

Id_no artist_name Year_created Title Art_type description


1 ibrahim 1999 modern painting It is a modern
type of
painting
2 karthik 2000 abstract painting It is a abstract
of painting
3 likith 2001 abstract1 statue It is a abstract
type of statue
4 darshan 1998 modern1 statue It is a modern
type of statue

You might also like