Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
28 views
Dbms Queries
DBMS queries
Uploaded by
Navyasree Golusula
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save dbms queries For Later
Download
Save
Save dbms queries For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
28 views
Dbms Queries
DBMS queries
Uploaded by
Navyasree Golusula
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save dbms queries For Later
Carousel Previous
Carousel Next
Save
Save dbms queries For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 8
Search
Fullscreen
der the relational schema for Part of the dreamhome case study © saints: "Create a database with name “DreamHeme” and now create all the tables sted above with const + Sranch(branchno streetcty postcode) Create table b varchar(8)}; stcode "ch(branchno char) primary key stret varchar(20) not nul city varcha(20) not nl PO! utp Table created, 2.statt St2tfno,fname,tame,position sex,008,salarybranchno) ‘“reate table staffistatino varchar(7) primary key,{name varchar(10) not null,Iname varchar(10) ot nullpostion varchar(20) not nulsex char,008 date salary decimal(7,4) not null,branchno char( 4) not null foreign key(branchno) references branch{branchno)); Output: Table created. 3-Porpertyforrent(propertyno street, city,postcode,type,rooms,rent, Greate table propertyforrent(propertyno char{) primary key,stret varchar(20) not null city varchar(15) not nll, OS" 20de varchar(6) not null, type varchar(8) not null,rooms smallint not null, rent decimal(9,3) not null,ownerno. varchar(7) not null, staffno: ‘varchar(5) foreign key(staffno) references staff (staffno),branchno char(4) not null); ownerno,staffno.branchno) Output: Table created. 4.Client(ctientno,fname,Iname,telino,preftype,maxrent email) create table client(clientno char(4) primary key fname varchar(10) not null,iname varchar(10) not null, telino varchar(20) not null,preftype varchar(8) not null maxrent decimal(6,1),email varchar(25) not null; null); Output: Table created. 5.Privateowner(owerno fname,name,address,tellno,emall, password) create table privateowner(ownerno char(4) primary key, fname varchar(8) not nullname varchar(10) not null,address varchar(30) not nulltelino varchar(15) not null, email varchar(25) not nul passsword varchar(10)); Output: Table created. 6.Viewing(clientno,propertyno,viewdate,viewcomment) create table viewing(clientno varchar(6) primary key,propertyno varchar(8) not null,viewdatedate,viewcomment varchar(20)); Output: Table created. Scanned with CamScannersaistration{clientno,branchno,staffno,datejolned) fate table registration(ctinetno char(4) primary key,branchno varchar(6) not nullstaffno varchar(6) not nul, ‘tejoined date}; Output: Table created 2,Jinsert a new row into the table supplying data for all columns 2.Biunch(branchno,street,city,postcode) insert into branch values('8005 22 Deer Rd! "London’ SW1AEH'); 1 row created. insert into branch values ('8007''16 Argyl St‘Aberdeen’’AB2 35U)); 1 row created. insert into branch values('B003''163 Main St, 'Glasgow’,'G11 90%’); 1 row created. inert into branch values('8004"/'32 Manse Rai,’Bristol,'3S99 1NZ’); 1 row created. insert into branch values('8002','6 Clover Dr'London’,'NW 10 6EU'); row created, select * from bran BRANCHNO STREET cay POSTCODE B005 22 Deer Rd London’ ‘Swi 4EH 8007 16 Areyilst Aberdeen ‘AB2 3SU 003 163 Main St Glasgow G11 90x Boos 32 Manse Rd Bristol 18599 1NZ 002 56 Clover Dr London NW 10 6U 2.Stafi(staffno,fname,lame position sex,DOB, salary, branchno) insert into staff values('S121', John',White',’Manager’,'M''1-Oct-45','30000','B005'); Lrow created. insert into staff values('SG37’,'Ann','Beech','Assistant’ F'10-Nov-60'/'12000,'8003'); 1 row created. insert into staff values('SG14’,'David','Ford' ‘Supervisor ''24-mar-58,'18000",'8003'); 1 row created. insert into staff values('SAS'/Mary' Howe',’Assiatant’ ,'19-Feb-70',9000','8007'); 1 row created. : insert into staff values('SGS" Susan’ 'Brand',’Manager’,F'3-jun-40','24000' 8003); 11 row created. cert into staff values('SLJulie''Loe' Assistant’ ''13-june-40','9000''8005'); ins Scanned with CamScannersow created, select * from staff; | STAFFNO | FNAME | ~UNAME | Postion” | “s bon SALARY sia] John [White | ~ Manager| M | O1-0CT-45 30000 | - ‘Ann | Beech | Assistant | F | a0-NOVv-co |” 12000 S614] David [Ford | Supervisor | 2a-miansa | 18000 SAS Mary | Howe: Assiatant’ | F | 19-FEB-70 ‘9000 8007 $65] Susan | Brand Manager | F | O34UN-40 24000 ‘8003, Sar Tulle toe ‘sistant | F | 43dUN40 9000 8005 3.Porpertyforrent(propertyno,street city, postcode, type, rooms,rent,ownerno,staffno.branchno) insert into propertyforrent values('PA14'16 Holhead' ‘Aberdeen',’AB7 5SU’,'House’'6''650, ‘coal \'SA9! 'B007"); 1 row created. insert into propertyforrent values('PL94’,'6 Argyl St London','Nw2;, Flat, 4','400'/CO87" 1'5L41'/'B005'); t row created. insert into propertyforrent values('PG4','6 Lawrence St'/Glasgow',’G11 9QX;,'Fat,'3,350'" c040',"'8003'}; L row created. 175''C093'S637 insert into propertyforrent values('PG36,'2 Manor Rd 'Glasgow',/G32 40X Flat’ "18003"; Lrow created. insert into propertyforrent values('PG21'/'18 Dale Rai, 'Glasgow’'G12', "S637, Lrow created. 50'CO Novar Dr''Glasgow’,'G12 AX, Flat’ insert into propertyforrent values(/PG1 93'/'SG14'/'B003"); 1 row created Scanned with CamScanner._ lect * from propertyforrent1; eROPERTYNO | STREET | CITY | POSTCODE | TYPE RENT [ OWNERO | STAFENO | BRANCHNO PAI4 16 Aberdeen | AB75SU | House | 6 650 C046 SAD 007 Hothead PLO4 G Argyll | London Nw2 Flat | 4 400, co87 SL41 00S St PG4 6 3 350 co40 8003 Lawrence | Glasgow | G1190X | Flat St PG36 2Manor | Glasgow | G32 4QX Flat | 3 375 C093 ‘$637 003 Rd PG21 18Dale | Glasgow G12 House | 5 600 co87 $637 B003 Rd PG16 SNovar | Glasgow G12 AX Flat | 4 450 C093 SG14 B003 Dr Grows selected. 4.Client{clientno,fname,Iname,tellno,preftype,maxrent,email) insert into client values('CR76,John’,'Kay’0207-774-5632,, lat’ '425',
[email protected]
'); 1 row created. Insert into client valuest'CRS6,Aline'Stewart’'0141-848-185' lat’ '350','
[email protected]
'); 1 row created. insert into client values('CR74','Mike' 'Ritche' '01475-392176,,'House’,'750,'
[email protected]
'}; Lrow created. insert into client values('CR62!,"Mary,Tregear,'01224-196720', Fat','600''
[email protected]
’); L row created, select * from client; CLIENT [FNAME] LNAME | TELLNO PREFTYPE | MAXRENT | EMAIL R76__| John _| Kay | 0207-774-5632 Tat 425 | john.kay@gmailcom R56 | Aline _| Stewart | 0141-848-1825 | flat 350 |
[email protected]
CR74__| Mike | Ritche | 01475-392176 | House | 750 |
[email protected]
cR62__| Mary _| Tregear_| 01224-196720 Flat 600 __ |
[email protected]
5.Privateowner{ownerno,fname,iname,address,tellno,email,password) insert into privateownervalues('CO46',Joe,'Keogh’,'2 Ferguus Dr,Aberdeen AB2 7Sx’,01224- ieeweenens): 861212,
[email protected]
’, row created. insert into private owner valuest"CO87’,'Carol,'Farrel’,'6 Achray St,Glasgow G32 9AX’,0141-848- 1825,'
[email protected]
,*****#**'); 1 row created. insert into privateownervalues('CO40’,‘Tina',’Murphy''63 Well St,Glasgow G42', 0141-943- 1728,'
[email protected]
’,'********"); row created. Scanned with CamScannerinsert into privteownervalues('CO93},"Tony’,'shaw’'12 Park Pl,Glasgow G4 OQR’,0141-225-7025, ‘tony
[email protected]
, *#+¥4940 ‘Lrow created. select * from privateowner; ‘OWNE | FNAME | LNAME “ADDRESS TELINO EMAIL PASSWORD RNO Coa6 | Joe | Keogh | 2FerguusDrAderdee | 01224861212 | _
[email protected]
coueeaee 1 AB27SX C087 | “Carol | Farrel | 6 Achrayst,Glasgow | 0141-357-7419 | cfarrel@gmailcom G3290x Coao | Tina | Murphy | 63WellSt,Glasow | 0141-943-1728 | tinam@hotmailicom a2 O83 | Tony | Shaw | 12ParkPllasgow | 0141-2257025 | tonyshaw@arkcom | ****ee* Ga00R 6.Viewing(clientno,propertyno,viewdate,viewcomment) insert into viewing values('CR56;PA14''24-May-13'Too small’; 1 row created, insert into viewing values('Cr76",'PG4’,'20-Apr-13','too remote’); Lrow created insert into viewing values('CRS6;,'PG4’,26-May-135'"); Lrow created. insert into viewing values('CR62',PA14’,'14-May-13','no Dining Room’); 1 row created. insert into viewing values('CRS6;PG36,'28-Apr-135,"); 1 row created. select * from viewing; CLENT PROPERTY VIEWDATE VIEWCOMMENT RSS PAIS 24MAY-13 “Too small 176 PGS 20-APR-13 too remote RSE PGs 26-MAY-13 R62 PAI EURYINEE] ‘no Dining Room CRS6 P36 28-APRA3 7.Registration(clientno,branchno,staffno,datejoined) insert into registration values('CR76;,'B005','SL4: row created. insert into registration values('CRS6','B003', row created. insert into registration values('CR74','8003''SG37\"16-Nov-11); Scanned with CamScannerA row created, tnsert into registration values('CR62''8007'SA9',7-Mar-12'), 1 row created, select * from registration; CLINENTNO. BRANCHNO _[STAFFNO | _DATEJOINED CR76 O05 Sud O2-JAN-13 RSG 003 ‘G37 LLAPR-12 R74 003 ‘5637 16-NOV-11 CREZ 8007 SA. (O7-MAR-12 23. update Staff set fName="Dravid' where staffNo='SL21"; Select * from Staff; Output: STAFENO FNAME” LNA! siz Dravid White 037 Ann Beech son Dead For May Howe ‘Susan Brand ie bse POSITION Manager ‘sistant ‘Assistant u & Supenisor F F F Manager 4, Delete from Staff where staffNo='SL41'; Select * from Staff; STAFFNO sit David White sc37 Ann Beech sore David = Ford Mary Howe Susan FNAME _LNAME POSITION S.alter table Branch add email varchar(20);, desc Branch; output: Table Column _ ppawc BRANCHN u 9 STREET omy POSTCODE EMAIL Data Type ‘Number Varchar2 Varehar2 Number Varchar2 Lengt 2 20 SEX sex” //b08 SALARY BRANCHNO 01 30000 8005, foNov.so 12000 003 2aMaR-s8 16000 8008 19FEB-70 9000 007 Precisle | Seal Primary Key SALARY BRANCHNO | Nultabt QNVOn 8 Defaut t Commen t Scanned with CamScanner_/& drop table Branch; desc Branch; output: Object to be described could not be found, 7. truncate table em select * from emp; output: ho data found 8. create index Indext on Staff(fName,|Name); Output: Index created. drop index Index on Staff; 9. select * from Registration; Output: {[GLieWTNO” BRANCHNO” STAFFHO DATEVONED rn a cre mn sor tans | cam cov wenover | neem cao onan 10. select * from Staff; Output: waite” POSITION” SEX DOB SALARY BRANCHNO | FNAME “bravid White -—=«sManager-=«M~—=«=«OY-0CT-45 20000 BOOS | Ann Beech Assistant «= F_=S«TONOVSD 12000 BOS Dovid Ford =—=««Supervisor.«M=—24MARSB 18000 (8003 May Howe = Assitant «=F IOFEB-7O 8000 007 F GaUN40 24000 BOO | 11, select * from Staff where salary>10000; output SYAFFNO FNAME LAME” PosiTioN SALARY” BRANCHNO Soma Wite Manager a gor km ook Matat waa ‘sGi4 David Ford ‘Supervisor M 18000 003, | r F 03-JUN-40 Manager Output: Scanned with CamScanner_ARoPERTYNO Poa Pata 13. select staffNo,{Name,IName,salary from Staff; output: STAFFNO FNAME LNAME SALARY si2t David — Whte 30000 | so37 An Beech 12000 | sou David Ford 18000 | sao May Howe 9000 | S65 susan Brand 2400 Scanned with CamScanner
You might also like
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
From Everand
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
Mark Manson
4/5 (6125)
Principles: Life and Work
From Everand
Principles: Life and Work
Ray Dalio
4/5 (627)
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
From Everand
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
Brené Brown
4/5 (1148)
Never Split the Difference: Negotiating As If Your Life Depended On It
From Everand
Never Split the Difference: Negotiating As If Your Life Depended On It
Chris Voss
4.5/5 (932)
The Glass Castle: A Memoir
From Everand
The Glass Castle: A Memoir
Jeannette Walls
4/5 (8214)
Grit: The Power of Passion and Perseverance
From Everand
Grit: The Power of Passion and Perseverance
Angela Duckworth
4/5 (631)
Sing, Unburied, Sing: A Novel
From Everand
Sing, Unburied, Sing: A Novel
Jesmyn Ward
4/5 (1253)
The Perks of Being a Wallflower
From Everand
The Perks of Being a Wallflower
Stephen Chbosky
4/5 (8365)
Shoe Dog: A Memoir by the Creator of Nike
From Everand
Shoe Dog: A Memoir by the Creator of Nike
Phil Knight
4.5/5 (860)
Her Body and Other Parties: Stories
From Everand
Her Body and Other Parties: Stories
Carmen Maria Machado
4/5 (877)
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
From Everand
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
Margot Lee Shetterly
4/5 (954)
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
From Everand
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
Ben Horowitz
4.5/5 (361)
Steve Jobs
From Everand
Steve Jobs
Walter Isaacson
4/5 (2922)
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
From Everand
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
Ashlee Vance
4.5/5 (484)
The Emperor of All Maladies: A Biography of Cancer
From Everand
The Emperor of All Maladies: A Biography of Cancer
Siddhartha Mukherjee
4.5/5 (277)
A Man Called Ove: A Novel
From Everand
A Man Called Ove: A Novel
Fredrik Backman
4.5/5 (4972)
Brooklyn: A Novel
From Everand
Brooklyn: A Novel
Colm Toibin
3.5/5 (2061)
Angela's Ashes: A Memoir
From Everand
Angela's Ashes: A Memoir
Frank McCourt
4.5/5 (444)
The Art of Racing in the Rain: A Novel
From Everand
The Art of Racing in the Rain: A Novel
Garth Stein
4/5 (4281)
The Yellow House: A Memoir (2019 National Book Award Winner)
From Everand
The Yellow House: A Memoir (2019 National Book Award Winner)
Sarah M. Broom
4/5 (100)
The Little Book of Hygge: Danish Secrets to Happy Living
From Everand
The Little Book of Hygge: Danish Secrets to Happy Living
Meik Wiking
3.5/5 (447)
The World Is Flat 3.0: A Brief History of the Twenty-first Century
From Everand
The World Is Flat 3.0: A Brief History of the Twenty-first Century
Thomas L. Friedman
3.5/5 (2283)
Bad Feminist: Essays
From Everand
Bad Feminist: Essays
Roxane Gay
4/5 (1068)
Yes Please
From Everand
Yes Please
Amy Poehler
4/5 (1987)
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
From Everand
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
Gilbert King
4.5/5 (278)
The Outsider: A Novel
From Everand
The Outsider: A Novel
Stephen King
4/5 (1993)
The Woman in Cabin 10
From Everand
The Woman in Cabin 10
Ruth Ware
3.5/5 (2619)
A Tree Grows in Brooklyn
From Everand
A Tree Grows in Brooklyn
Betty Smith
4.5/5 (1936)
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
From Everand
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
Viet Thanh Nguyen
4.5/5 (125)
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
From Everand
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
Dave Eggers
3.5/5 (692)
Team of Rivals: The Political Genius of Abraham Lincoln
From Everand
Team of Rivals: The Political Genius of Abraham Lincoln
Doris Kearns Goodwin
4.5/5 (1912)
Wolf Hall: A Novel
From Everand
Wolf Hall: A Novel
Hilary Mantel
4/5 (4074)
On Fire: The (Burning) Case for a Green New Deal
From Everand
On Fire: The (Burning) Case for a Green New Deal
Naomi Klein
4/5 (75)
Fear: Trump in the White House
From Everand
Fear: Trump in the White House
Bob Woodward
3.5/5 (830)
Rise of ISIS: A Threat We Can't Ignore
From Everand
Rise of ISIS: A Threat We Can't Ignore
Jay Sekulow
3.5/5 (143)
Manhattan Beach: A Novel
From Everand
Manhattan Beach: A Novel
Jennifer Egan
3.5/5 (901)
John Adams
From Everand
John Adams
David McCullough
4.5/5 (2530)
The Light Between Oceans: A Novel
From Everand
The Light Between Oceans: A Novel
M L Stedman
4.5/5 (790)
The Unwinding: An Inner History of the New America
From Everand
The Unwinding: An Inner History of the New America
George Packer
4/5 (45)
Little Women
From Everand
Little Women
Louisa May Alcott
4/5 (105)
The Constant Gardener: A Novel
From Everand
The Constant Gardener: A Novel
John le Carré
3.5/5 (109)
Related titles
Click to expand Related Titles
Carousel Previous
Carousel Next
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
From Everand
The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
Principles: Life and Work
From Everand
Principles: Life and Work
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
From Everand
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
Never Split the Difference: Negotiating As If Your Life Depended On It
From Everand
Never Split the Difference: Negotiating As If Your Life Depended On It
The Glass Castle: A Memoir
From Everand
The Glass Castle: A Memoir
Grit: The Power of Passion and Perseverance
From Everand
Grit: The Power of Passion and Perseverance
Sing, Unburied, Sing: A Novel
From Everand
Sing, Unburied, Sing: A Novel
The Perks of Being a Wallflower
From Everand
The Perks of Being a Wallflower
Shoe Dog: A Memoir by the Creator of Nike
From Everand
Shoe Dog: A Memoir by the Creator of Nike
Her Body and Other Parties: Stories
From Everand
Her Body and Other Parties: Stories
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
From Everand
Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
From Everand
The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
Steve Jobs
From Everand
Steve Jobs
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
From Everand
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
The Emperor of All Maladies: A Biography of Cancer
From Everand
The Emperor of All Maladies: A Biography of Cancer
A Man Called Ove: A Novel
From Everand
A Man Called Ove: A Novel
Brooklyn: A Novel
From Everand
Brooklyn: A Novel
Angela's Ashes: A Memoir
From Everand
Angela's Ashes: A Memoir
The Art of Racing in the Rain: A Novel
From Everand
The Art of Racing in the Rain: A Novel
The Yellow House: A Memoir (2019 National Book Award Winner)
From Everand
The Yellow House: A Memoir (2019 National Book Award Winner)
The Little Book of Hygge: Danish Secrets to Happy Living
From Everand
The Little Book of Hygge: Danish Secrets to Happy Living
The World Is Flat 3.0: A Brief History of the Twenty-first Century
From Everand
The World Is Flat 3.0: A Brief History of the Twenty-first Century
Bad Feminist: Essays
From Everand
Bad Feminist: Essays
Yes Please
From Everand
Yes Please
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
From Everand
Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
The Outsider: A Novel
From Everand
The Outsider: A Novel
The Woman in Cabin 10
From Everand
The Woman in Cabin 10
A Tree Grows in Brooklyn
From Everand
A Tree Grows in Brooklyn
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
From Everand
The Sympathizer: A Novel (Pulitzer Prize for Fiction)
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
From Everand
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
Team of Rivals: The Political Genius of Abraham Lincoln
From Everand
Team of Rivals: The Political Genius of Abraham Lincoln
Wolf Hall: A Novel
From Everand
Wolf Hall: A Novel
On Fire: The (Burning) Case for a Green New Deal
From Everand
On Fire: The (Burning) Case for a Green New Deal
Fear: Trump in the White House
From Everand
Fear: Trump in the White House
Rise of ISIS: A Threat We Can't Ignore
From Everand
Rise of ISIS: A Threat We Can't Ignore
Manhattan Beach: A Novel
From Everand
Manhattan Beach: A Novel
John Adams
From Everand
John Adams
The Light Between Oceans: A Novel
From Everand
The Light Between Oceans: A Novel
The Unwinding: An Inner History of the New America
From Everand
The Unwinding: An Inner History of the New America
Little Women
From Everand
Little Women
The Constant Gardener: A Novel
From Everand
The Constant Gardener: A Novel