0% found this document useful (0 votes)
31 views11 pages

Create The Movie Database With The Following Relation Schema Where The Primary Keys Are Underlined

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)
31 views11 pages

Create The Movie Database With The Following Relation Schema Where The Primary Keys Are Underlined

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/ 11

ST.

XAVIER’S COLLEGE
MAITIGHAR, KATHMANDU, NEPAL
Phone: 01-5321365, 01-5344636
Email: [email protected]

LAB/WRITTEN ASSIGNMENT NUMBER:


“DATABASE MANAGEMENT SYSTEM ”

Submitted By Submitted To Signature


Name: Sambridh Pokharel Mr. Mrigendra Pradhan
Roll No: 902 Department of Computer
Science,
Class:12
St. Xavier’s College
Section:I

Submission Date: 15th JULY, 2023


Contents
Create the movie database with the following rela on schema where the primary
keys are underlined...............................................................................................3
CONCLUSION.....................................................................................................................................8
Create the movie database with the following rela on schema where the
primary keys are underlined.
query
CREATE TABLE
movie_list ( mid int,
name varchar(200), genre
varchar(200), year_made
INT, budget INT,
primary key (mid)
);
Output

b. Add five data to the database table.


Ans INSERT INTO movie_list (mid, name, genre, year_made, budget )
VALUES (1, 'ShawshankRedemp on', 'Social', 1994, 250000),
(2, 'Dangal', 'Social', 2016, 2500000),
(3, 'FightClub', 'Social', 2001, 15000000),
(4, 'Animal', 'Romance', 2024, 5000000),
(5, 'PK', 'Social', 2018, 30000)
;

c. Retrieve all the information from the above


table.
d. Update the genre to action. Ans SELECT *
FROM `movie_list`;
UPDATE movie_list
SET genre= 'ac on'
WHERE mid=1;
Output

e. Delete the data where the genre is thriller.


Ans
DELETE FROM movie_list WHERE genre=
'social';
Output

a. Create database clients.

CREATE DATABASE clients;

b. Create table client_info including columns: client_id(int), client_name(varchar),

client_address(varchar), dateofpurchase(date) CREATE TABLE client_info


( client_id int, client_name varchar(200), client_address varchar(200),
dateofpurchase date, primary key (client_id)
);
c . Modify the table client_info by adding column contact_info .
ALTER TABLE client_info
ADD contact_info int;

d. Modify the table client_info by changing the type varchar of client_address column to text

ALTER TABLE client_info


MODIFY client_address text;

e. Drop the column client_address from the client_info table.

ALTER TABLE client_info


DROP COLUMN client_address;

f. Insert at least five records in the client info table.

INSERT INTO client_info (client_id, client_name, dateofpurchase, contact_info )


VALUES (1, 'Samarpan Bha arai', 1994, 9803698510),
(2, 'Sambridh Pokharel', 1984, 9803698910),
(3, 'Sameep Poudel', 1994, 9805698510),
(4, 'Samir Acharya', 1994, 9803693510),
(5, 'Samir Poudel', 1994, 9807698510)
;
h. Display record of a client whose id is 3.

ans
Query:
SELECT * FROM `cilent_info` WHERE client_id=3;

OUTPUT
j. Display all records from table client_info table in descending order.
SELECT * FROM `cilent_info` WHERE 1
order by client_name desc;

OUTPUT

k. Update contact_no of client whose client_id is 1 to 9841999999.


Ans: Query:
SELECT * FROM `cilent_info` WHERE 1;
update cilent_info
set contact_info = '9841999999'
where client_id=1;

OUTPUT
l. Update client_name, client_address, contact_no using update command of at
least
one client.
Ans;
SELECT * FROM `cilent_info` WHERE 1;
update cilent_info
set client_name='Ramesh'
where client_id=2;

OUTPUT

CONCLUSION
In conclusion, managing a database effectively involves a series of systematic steps to ensure
data integrity and accessibility. Initially, a database named clients was created to store client
information. Within this database, a table called client_info was established, featuring columns
for client ID, name, address, and date of purchase. The table was subsequently modified to
include a contact_info column and to change the client_address column's data type to text for
greater flexibility. Additionally, the client_address column was removed to streamline the
dataset. Five records were then inserted into the client_info table, ensuring a diverse set of client
information. Queries were executed to display all records, fetch specific records, and sort data in
both ascending and descending order, demonstrating the ability to retrieve and manipulate data
efficiently. Updates to the contact_info and other columns showcased the capability to maintain
up-to-date client records. Overall, these operations highlight the essential database management
tasks necessary for maintaining an organized and accessible client database.
My laptop couldn’t open xamp so fom question , I have taken help from my friends work.

You might also like