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)
35 views
21 pages
Computer Practicle File
Uploaded by
नमस्कारम्
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Download as pdf
Save Computer Practicle File For Later
Download
Save
Save Computer Practicle File For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
35 views
21 pages
Computer Practicle File
Uploaded by
नमस्कारम्
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Download as pdf
Save Computer Practicle File For Later
Carousel Previous
Carousel Next
Save
Save Computer Practicle File For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
Download as pdf
You are on page 1
/ 21
Search
Fullscreen
ASSISI CON V NT SCHOOL oda, Ullar Pragesn- 2021-22 PRACTICAL FILE AS PER CBSE GUIDLINES s.EKTA SAHNI4. Consider the table STUDENT with the above data and define the first column SID as primary key , feed all the records in the table and then answer the following queries STUDENT a)To count the number of students in each section._ ANS: SELECT section, count() FROM student GROUP BY section;b) To display the names of the student who got “Excellent” remark in their project. Ans: SELECT name FROM student WHERE proj_rem="Excellent”; C) To increase the marks of the student “Raj” in CS by 5. ANS: UPDATE student SET CS=CS+5 WHERE name='Raj’ OUTPUT: d) The display the names of the students ending with “a”. Ans: SELECT name FROM student WHERE name like ‘%a’; ) To display the details of the student whose IT marks are in the range 25 to 35. ‘Ans: SELECT * FROM student WHEREIT BETWEEN 25 AND 35; f) To display the name of the student who secured maximum marks in IT. ns: SELECT! JTFROM student ORDER BY IT limit 1; Q)To insert a new row with values (105,’Shreya’,12,’D’,40,38,’Excellent’)2 INSERTINTO student VALUES(105, ‘Shreya’,12,’D’,40,38, Excellent’) (OUT PU aera 2. Consider the following table and answer the following queries. a) To retrieve all the information about the teacher with id 104. ELECT * FROM teacher WHERE teacher_id=104; b)To find the names of all the teachers earning more than 30000. Ans: SELECT f_name,!_nameFROM teacher WHERE salary>30000; OUTPUT: rn Pra) C)To display teacher_id, first name, last name and dept_no of teachers who belong to department 1. ‘Ans: SELECTteacher_id,f_name,!_name,dept_noFROMteacher WHEREdept_no=1; OUTPUT: Corea eee ee 104 1 Rachnid) To retrieve names of all teachers and the names and numbers of their respective departments. Ans: SELECT f_name, |_name,dept_no,dept_name FROM teacher; oureur: fj Prete eee e) To display department numbers corresponding to department having male teachers. Ans: SELECT dept_no FROM teacher WHERE gender ‘OUTPUT: Ans: SELECT DISTINCT dept_name FROM teacher; Ce coreeea Hindi rete 9) To list firstname, last name in alphabetical order. Ans: SELECT? name,! name FROM teacher ORDERBY f_name ASC; ourPuT: h) To retrieve name of teachers havingat least 6 characters in firstname. Ans: SELECTf_name,!_nameFROMteacherWHEREf_nameLiKE‘ __*;Consider the following table named “GYM” with details about PrCode stores the Codes of Products PrName stores names of Products UnitPrice is inRs. TABLE:GIOL a) Display the names of all the products in the store. ans: SELECT PrName FROM gym: ‘OUTPUT: ») Display the names and unit price of all the products in the store. ‘ans: SELECT PrName,UnitPrice FROM gym; OUTPUT: ©) Display the names ofall the products in the store with unit price less than Rs20000, ‘ans: SELECT PrName FROM gym WHERE UnitPrice<20000; es Bike 4) Display details ofall the products in the store with unit price in the range 20000 to 30000, ans: SELECT’ FROM gym WHERE UnitPrice BETWEEN 20000 AND 30000;‘OUTPUT: cee @) Display names of all products by the manufacturer “Fit Express”. ‘ans: SELECT PrName FROM gym WHERE Manufacturer='Fit Express"; ‘Ans: SELECT * FROM gym ORDER BY UnitPrice DESC; ‘OUTPUT, 19) Add a new row for product with the details; P106", Vibro Exerciser” 23000, manufacturer: "AvonFitness”. ns: INSERT INTO gym VALUES('P106;, "Vibro Exerciser’,23000, ‘Avon Fitness’); hh) Change the UnitPrice ofall the rows by applying a 10% discount reduction on al the produets. ns; UPDATE gym SET UnltPrice=0.9*UnitPrice; ‘OUTPUT; 1) Display details ofall products with manufacturer name sta Ans: SELECT* FROM gym WHERE Manufacturer LIKE ‘A%' 4, Considerthe following Emplovee table: Table Name: Employeehe primary key ofthis table Is Employee 1D and Manager 1D is the foreign key that references Employee 1D. |write SaL commands for thetollowing, a) Create the above table. ars: CREATE TABLE Employee(Eimployee 1D nt(4, Employee Name varchar(7),Job Tile varchar(10) Salary int(5),Bonus int(4),Age int(2),Manager_1D int(4); ‘OUTPUT: ss _ lb) insert the values as shown above. ans: | INSERT INTO Employee VALUES(1201, ‘Divya’, ‘President’,50000,null,29,null); INSERT INTO Employee VALUES(1205, Amyra'"Manager’30000,2500,26,1201); INSERT INTO Employee VALUES(1211,Rahul,/Analyst’,20000,1500,23,1208): INSERTINTO Employee VALUES(1213,'Manish‘Salesman',16000,null, 22,1208); INSERT INTO Employee VALUES(1216,’‘Megha’ Analyst’ 22000, 1300, 25,1201); INSERTINTO Employee VALUES(1217, Mohit’ ‘Salesman’, 16000,null 22,1208) ¢} Delete the employee having Employee 1D 1217. dns: DELETE FROM Employee WHERE Employee D=1217; ourPut 4) Update the salary of ‘Amyra’ to 40000.‘ansi UPDATE Employee SET Salary=40000 WHERE Employee Name=Amyra'; ouTPUT; ¢) Alter the table Employee so that NULL values are not allowed for Age column, ‘ns: ALTER TABLE Employee MODIFY Age int(2) NOT NULL; ‘OUTPUT: {| Write a query to display names and salaries of those employees whose salary is greater than 20000, ns; SELECT Employee Name,Salaty FROM Employee WHERE Salary>20000; 9) Write a query to display details of employees who are not getting any bonus. ‘ns: SELECT * FROM Employee WHERE Bonus IS null; ©) Alter the table Employee so that NULL values are not allowed for Age column. ans: ALTER TABLE Employee MODIFY Age int(2) NOT NULL; ‘OUTPUT: {) Write a query to display names and salaries of those employees whose salary is greater than 20000. Ans: SELECT Employee Name,Salary FROM Employee WHERE Salary>20000; 9) Write a query to display details of employees who are not getting any bonus. Ans: SELECT * FROM Employee WHERE Bonus IS nullOUTPUT: h)Write a query to display the names of employees whose name contains ‘a’ as the last alphabet Ans: SELECT Employee Name FROM Employee WHERE Employee Name LIKE "%a’ Ered le andjob title of those employees whose Manager_IDis 1201. Ans: SELECT Employee _Name,Job Title FROM Employee WHERE Manager D=1201; |) Writea query to display the name and Job title of those employees whose Manager is ‘Amyra’ Ant: SELECT A.Employee Name,A.Job Tile FROM Employee A,Employee B WHERE B.Employee Name='Amyra’ AND D: ons 1) Write aquary to dsplay the name andjob tie of those employees aged between 26 and 30(both inclusive) ‘ans: SELECT Employee Name, Job_Title FROM Employee WHERE Age BETWEEN 26 AND 30; roku ees rs rr rg i ertTablesRECIPIENT es 2) To display the details of those senders whose city is "New Delhi" Ans: SELECT * FROM sender WHERE SenderCity= New Delhi’; ¢) To display the sender details in ascending order of SenderNam Ans: SELECT * FROM sender ORDER BY SC; ~ baa 4) To display the names ofthe sender starting with Ans: SELECT" FROM sender WHERE SenderName LIKE ‘R% ©) To display the sendername, sender address from table sender and: table recipient with their corresponding matching senderid. Ans: SELECT SenderName,SenderAddress,RecName,RecAddress FROM sender recipient WHERE ‘sender.SenderlD=recipient SenderiD; £) To display the number of sender belonging to each city. Ans: SELECT SenderCity.count(SenderCity) FROM sender GROUP BY SenderCity; 6, Consider the following tables CABHUB and CUSTOMER. “Table:cannus‘Write Sat commands forthe statements (a) 0) 2) To display the names of al the white coloured vehicles from the cabhub table. Ans: SELECT vehiclename FROM cabhub WHERE color="White'; ourpur: ») To display name of vehicle , make and capacity of vehicles in ascending order oftheir seating capacity. Ans: SELECT vehiclename,make.capacity FROM cabhub ORDER BY capacity ASC; OUTPUT: Jans: UPDATE cabhub SET charges=charges+5; ‘ourPUT: _) To display the vehicle name,cname from the tables cabhub,custor ans: SELECT vehiclename,cname FROM cabhub, customer WHERE cabhub.vcode=customer.vcode; ‘ouTeur: Jans: SELECT color,count(*) FROM cabhub GROUP BY color; ‘OUTPUT:9} Display veode, vehiclename,make and customer name from the table customer and vehicle with their corresponding matching id of veo Ans: SELECT cabhub vcode, veiclename,make,cname FROM cobhub,customer WHERE cabhub.veode=customer vcode; ') To Display the details ofthe product whose price isin the range of $0 t0100. [Ans: ELECT * FROM product WHERE price BETWEEN 50 AND 100; «) Totncrease the price by Rs. 200 inthe tableProduct, [Ans: UPDATE produit SET pice-price+200; ‘ouTPUT: 4) To Display the productname in the ascending order inthe table Product. ‘ans: SELECT prod. name FROM product ORDERBY prod_name; ‘OUTPUT:©) To display product name, manufacturer city from the table Product and client. ‘Ans: SELECT prod_name,manufacturercity FROM productclen 4) Todisplay the number of elients belonging to each cy. a ‘a 8) To display the maximum, minimum price from the table product. Ans: SELECT max(price) min[price) FROM product ‘OUTPUT: ‘8, Consider the following tables EMPLOYEE and SALARY, Table: EMPLOYEE Leto ay )a) To display the details of those Employees whose name's “John” Ans: SELECT * FROM employee WHERE name="lohn’ ange 40000 to 70000. Ans: SELECT * FROM employee salaty WHERE salary BETWEEN 40000 AND 70000 AND employee ssrade=salary sarade; c) Toad new row with the values "2400,45000,503" In the table salary. Ans: INSERT INTO salary VALUES(2400,45000,'S2") cot «)Toinerease al the salaries byS000. [Ans: UPDATE salary SET salary=salary15000; TablesSSuEDa} Toshow the books of FIRST PUBL. Publishers written byP. Purohit. ans: SELECT * FROM books WHERE publshers="FRST PUBL.” AND author_name~'. Purohit OUTPUT: mpty set <@.@5 sec> b) Toisplay cost of all the books published byFIRST PUBL. ns: SELECT price FROM books WHERE publishers FIRST PUBL. c) Depreciate the price ofall books of EPB publishers by 5%. ans: UPDATE books SET price=price*0.95; 4) Toshow total cost of books of eachtype. ans: SELECT type.sum(price] FROM books GROUPSY type; ourpur: |<} Toshow the details ofthe costliestbook ns: SELECT * FROM books ORDER BY price DESC limit 3 TablepRoDUCT Table:Cuient Write Sat statements forthe queries (2)t0 (4) and output for (e) and (f: yased clients in Client table. ‘Del 8) Todlsplay the ClientName and City of all Mumba and De ‘ans: SELECT clientname,cty FROM client WHERE city”™Mumbat’ OR ct ourPur:Pree i re aC eed ais Past Dsus pre |<} Todlisplaythe Productivame, Manufacturer, Expiry Date ofall the products that exp ans: SELECT productname, manufacturer, expirydate FROM product WHERE expnydate 4) To display 10, Clentame, Cty ofall he cients (including the ones that have not purchaseda product) and thel correspondingProduct Name sold, ans: SELECT c id, clentname, chy, productname FROM client LEFT JOIN product ON product. id=cllent.p i ‘OUTPUT: 6) select count{ dstint Manufacturer] from product; “Table suPPUER ‘Write Sal commands for the statements (a) to (d) and give outputs for SL. queries (eo (h)2) To display details ofall the items in the Store table in ascending order of LastBuy. [Ans: SELECT * FROM store ORDER BY lastbuy ASC; @) select count{lstinctscode) from STORE; Z a #) select Rate *aty from STORE whereltemne=2004; 28) select tem. Sname from STORE, SUPPLIER P where S Scode hy) select manftastbuy) trom STORE;‘Answer the followingauestions 4) Display the sum ofall Loan Amounts whose Interest eat ‘Ans: SELECT sum|loan) FROM loans WHERE int_fate>10.00; perers Pen »b) Display the Maximum interest from Loans table. [Ans: SELECT maxfinterest) FROM loans com €) Display the count of allan holders whose name ends with ‘Sharma’ ‘Ans: SELECT count/*] FROM loans WHERE cust nameLKE "sSharma! OUTPUT: + 4) Display the count ofall oan holders whose interestis Null ‘Ans: SELECT count) FROM loans WHERE interest NULL; ouTPUT: e}Display the Interest wise detalls of Loan Account Holders. Ans: SELECT * FROM loans ORDER BV interest: +) Display the interest-wice details of Loan Account Holders with at least 10 installments remaining Ans: SELECT * FROM loans WHERE installments>=10 ORDER BY interest, OUTPUT: cra nes mT 13. Consider the followingtables: COMPANY and MODEL be:COMPANY Note: > Comp_10 isthe Primary key. > Model 10 isthe Primary key. > Comp ID isthe Foreign Key referencing Comp 10 of Company table.‘Waite SQL commands for queries (a) to (d) and output for(e)and () 42) To dleplay details of all modelsin the Mode! table in ascending order of DateofManufacture fans: SELECT * FROM model ORDER BY dateofmanufactureASC; 1b) To display detalls of those models manufacturedin 2011 and whore Costis below 2000. ‘ns: SELECT * FROM model WHERE dateofmanufa
100, eJToinsert a recordin the Stock table withthe values: (5010, enelt H8', 102,500, 10, 2010-01-26") Ans: INSERT INTO stock VALUES{S010, Pencil HB, 102, 500, 10, 2010-01-26") oureur: 4) To display Dcode, Dname from Dealer table and item, UnitPrice from Stock table ofall the Dealers (including the dealer details that have not sold anyitem) de, dname, item, unitprce FROM dealer LEFT IOIN st ON dealer dcode-stack dcode;
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 (6098)
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
Brene 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 (923)
The Glass Castle: A Memoir
From Everand
The Glass Castle: A Memoir
Jeannette Walls
4/5 (8214)
The Perks of Being a Wallflower
From Everand
The Perks of Being a Wallflower
Stephen Chbosky
4/5 (8365)
Sing, Unburied, Sing: A Novel
From Everand
Sing, Unburied, Sing: A Novel
Jesmyn Ward
4/5 (1253)
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 (947)
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)
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 (482)
Steve Jobs
From Everand
Steve Jobs
Walter Isaacson
4/5 (2922)
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)
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)
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)
A Tree Grows in Brooklyn
From Everand
A Tree Grows in Brooklyn
Betty Smith
4.5/5 (1936)
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 (4067)
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)
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)
Fear: Trump in the White House
From Everand
Fear: Trump in the White House
Bob Woodward
3.5/5 (830)
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)
DocScanner 4 Aug 2023 8-54 Am
PDF
No ratings yet
DocScanner 4 Aug 2023 8-54 Am
1 page
083 Cs Practical 2021-2022
PDF
No ratings yet
083 Cs Practical 2021-2022
58 pages
My JEEPlanner
PDF
No ratings yet
My JEEPlanner
1 page
Phycc101 Assignment Dr. Amrita
PDF
No ratings yet
Phycc101 Assignment Dr. Amrita
1 page
Payroll Management System Source Code
PDF
No ratings yet
Payroll Management System Source Code
15 pages
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
The Perks of Being a Wallflower
From Everand
The Perks of Being a Wallflower
Sing, Unburied, Sing: A Novel
From Everand
Sing, Unburied, Sing: A Novel
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
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
From Everand
Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
Steve Jobs
From Everand
Steve Jobs
The Emperor of All Maladies: A Biography of Cancer
From Everand
The Emperor of All Maladies: A Biography of Cancer
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
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
A Tree Grows in Brooklyn
From Everand
A Tree Grows in Brooklyn
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
Rise of ISIS: A Threat We Can't Ignore
From Everand
Rise of ISIS: A Threat We Can't Ignore
Fear: Trump in the White House
From Everand
Fear: Trump in the White House
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
DocScanner 4 Aug 2023 8-54 Am
PDF
DocScanner 4 Aug 2023 8-54 Am
083 Cs Practical 2021-2022
PDF
083 Cs Practical 2021-2022
My JEEPlanner
PDF
My JEEPlanner
Phycc101 Assignment Dr. Amrita
PDF
Phycc101 Assignment Dr. Amrita
Payroll Management System Source Code
PDF
Payroll Management System Source Code
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