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

CH Agnes

Uploaded by

sharmakeshav2255
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)
34 views11 pages

CH Agnes

Uploaded by

sharmakeshav2255
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

Que 16 –Create a student table (ADMNO,CLASSSEC,NAME,SCORE) and insert data.

Implement the following


SQL command son the student table

 ALTER table to add new attributes (SEXCHAR(1)/modify data type CHAR to VARCHAR/ drop a
attribute SEX
 UPDATE table to modify data- Increase the marks of all students by 10 who scored less than 20.
 ORDERBY to display data in ascending/descending order by (i)NAME wise (ii)SCORE wise
 DELETE to remove tuple(s) having SCORE less than 10.
 GROUP BY and find the min,max,sum,count and average.
Que 17 Create a EMPLOYEE table (EID, NAME, SALARY, DEPT) and insert data.Implement the following SQL
commands on the student table :
a) ALTER table to add new attributes–HRAINT(5)/modify data type of HRA to decimal drop attribute HRA
b) UPDATE table to modify data–increase the salaryby10%
c) ORDER BY to display data in ascending/descending order (i) SALARY wise(ii)EID wise
d) DELETE to remove tuple(s)–employeehavingempid101
e) GROUPBY and find the min, max, sum, count and average.
Que 18 Create a Database LIBRARY.  Create a table BOOKs (book_id (PK), book_name,
author_name,publishers,price,type,qty)andInsertrecords  Create a table ISSUED(issue_id, book_id (FK),
quantity_issued ) and Insert records.  Write the SQL queries–
 To show Book name, Author name and Price of books of FirstPubl.publishers. [SELECT,WHERE]
 To list the names from books of Text type. [SELECT,WHERE]  To display the names and price from books in
ascending order.[ORDERBY]
 To increase the price of all books of EPBpublishersby50.[UPDATE]
Que 19 Create Database COMPANY.  Create a table JOB (JOBID (PK), JOBTITLE, SALARY) and Insert Records.  Create
a table Employee (EID (PK), NAME, SALES, JOBID (FK)) and Insert Records  Write the SQL Queries for the following:
 To display employee ids, names of employees, job ids, with corresponding job titles. (JOIN QUERY)
 To display names of employees, sales and corresponding job titles who have achieved sales more than 130000.
(JOINQUERY).
Que 20 CreateaTableCLUB(CoachId,CoachName,Age,Sports,DateofApp,Pay,Sex)andInsertRecor ds.
 Write the SQL Queries for the following:-
 To display the list of coach who is playing KARATE.
 To display the records having Pay between 500 to 1000.
 To display the names of coach whose name starts with ‘A’.
 To display the total salary paid to Coach Gender wise.
 To display all records alphabetically on name.
 Give the output off following SQL statements:-
 SELECT COUNT (DISTINCT SPORTS) FROM CLUB;
 SELECT MIN(AGE) FROM CLUB WHERE SEX=‘M’;
 SELECT AVG (AGE) FROM CLUB GROUP BY SEX;
SELECT SUM (PAY) FROM CLUB WHERE DATE OF APP>’31-03-1998’
Thank
YOU

You might also like