Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
6 views

SQL PRACTICAL FILE QUESTIONS

Uploaded by

czxharshpreet
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

SQL PRACTICAL FILE QUESTIONS

Uploaded by

czxharshpreet
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

SQL PRACTICAL FILE QUESTIONS

Q1.
A. Create a student table (ADMNO, CLASS-SEC, NAME, SCORE) and insert
data.
B. Implement the following SQL commands on the student table:
 ALTER table to add new attributes (SEX CHAR(1) / modify data type
CHAR to VARCHAR/ drop attribute SEX
 UPDATE table to modify data- Increase the marks of all students by 10
who scored less than 20.
 ORDER BY 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
Q2.
A. Create a EMPLOYEE table (EID, NAME, SALARY, DEPT) and insert data.
B. Implement the following SQL commands on the student table:
 ALTER table to add new attributes – HRA INT(5) / modify data type of
HRA to decimal / drop attribute HRA
 UPDATE table to modify data – increase the salary by 10%
 ORDER BY to display data in ascending / descending order (i)SALARY
wise (ii) EID wise
 DELETE to remove tuple(s) – employee having emp id 101
 GROUP BY and find the min, max, sum, count and average.
Q3.
A. Create a Database LIBRARY.
B. Create a table BOOKs (book_id (PK), book_name, author_name,
publishers, price, type, qty) and Insert records
C. Create a table ISSUED(issue_id, book_id (FK), quantity_issued ) and
Insert records.
D. Write the SQL queries –
 To show Book name, Author name and Price of books of First Publ.
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.
[ORDER BY]
 To increase the price of all books of EPB publishers by 50. [UPDATE]
 To display the Book_Id, Book_Name. and Quantity_Issued for all books
which have been issued. [JOIN QUERY]
 To display the list of books having publisher value is NULL.
 To display the unique name of all Publishers.
 To display the Maximum and Average Price of Books Publisher
 wise.
E. Write the Output of the following queries based on the above tables.
 SELECT COUNT(*) FROM BOOKS;
 SELECT MAX(PRICE) FROM BOOKS WHERE QUANTITY >= 15;
 SELECT BOOK_NAME, AUTHOR_NAME FROM BOOKS WHERE
PUBLISHERS = “EPB”;
 SELECT COUNT(DISTINCT PUBLISHERS) FROM BOOKS WHERE
PRICE >= 400;
Q4.
A. Create a Database COMPANY.
B. Create a table JOB (JOBID (PK), JOBTITLE, SALARY) and Insert Records.
C. Create a table Employee (EID (PK), NAME, SALES, JOBID (FK)) and
Insert Records
D. 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. (JOIN QUERY)
 To display names and corresponding job titles of those employees who
have ‘SINGH’ (anywhere) in their names.
 Display the name of employee having maximum salary.
 Write the SQL command to change the JobId to 104 of the Employee
with ID as E4 in the table EMPLOYEE.
Q5.
A. Create a Table CLUB (CoachId, CoachName, Age, Sports, DateofApp, Pay,
Sex) and Insert Records.
B. 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.
C. Give the output of 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;
 SLEECT SUM(PAY) FROM CLUB WHERE DATEOFAPP > ’31-03-1998’

You might also like