Podcast
Questions and Answers
What is the primary key in the 'student' table?
What is the primary key in the 'student' table?
Which command would you use to insert a new student into the 'student' table?
Which command would you use to insert a new student into the 'student' table?
How would you retrieve students with marks greater than or equal to 80?
How would you retrieve students with marks greater than or equal to 80?
What is the purpose of the 'group by' clause in SQL?
What is the purpose of the 'group by' clause in SQL?
Signup and view all the answers
Which SQL command correctly returns the total number of customers grouped by country?
Which SQL command correctly returns the total number of customers grouped by country?
Signup and view all the answers
How do you sort the student records by name in descending order?
How do you sort the student records by name in descending order?
Signup and view all the answers
What does the following SQL command do: 'Select UPPER(pname) as ‘patient name’, YEAR(admitdate) as ‘admit year’ From hospital;'?
What does the following SQL command do: 'Select UPPER(pname) as ‘patient name’, YEAR(admitdate) as ‘admit year’ From hospital;'?
Signup and view all the answers
Which SQL command will correctly fetch the first four letters of patient names admitted before May?
Which SQL command will correctly fetch the first four letters of patient names admitted before May?
Signup and view all the answers
What command is used to create a new database in SQL?
What command is used to create a new database in SQL?
Signup and view all the answers
Which SQL command will display the names of coaches earning more than 3500 in ascending order of their names?
Which SQL command will display the names of coaches earning more than 3500 in ascending order of their names?
Signup and view all the answers
Study Notes
Practical-1
-
Problem: Create a
student
table withstudid
(primary key),name
, andmarks
. - Solution: SQL code to create the table.
Practical-2
-
Problem: Insert student details into the
student
table. -
Solution: SQL insert statements for various students (e.g., Sanjay, Surendra, Jamil, Rahul, Prakash), providing their
studid
,name
, andmarks
.
Practical-3
- Problem: Retrieve student details with marks above 80.
-
Solution: SQL query to filter students where
marks
are greater than or equal to 80.
Practical-5
- Problem: Calculate the total number of customers from each country.
-
Solution: SQL query to count customers by
country
.
Practical-6
-
Problem: Order student records (studid, marks) by
name
in descending order. -
Solution: SQL query to sort student records by
name
in descending order.
Practical-7 (Min, Max, Sum, Average)
- Problem: Find the minimum, maximum, sum, and average of marks.
-
Solution: SQL query using
min()
,max()
,sum()
, andavg()
functions on themarks
column.
Practical-8
- Problem: Display patient names in uppercase and admission year.
-
Solution: SQL query using
UPPER()
andYEAR()
functions onpname
andadmitdate
attributes, respectively.
Practical-9
- Problem: Display first four letters of patient names and the name length, for patients admitted before May.
-
Solution: SQL query using
LEFT()
andLENGTH()
functions.
Practical-10 (Creating and Inserting into a Table)
-
Problem: Create a database (e.g.,
abc
) and a table within it. Insert data into the table (e.g., Coach'scoachname
,age
,sports
,salary
,sex
details) -
Solution: SQL commands to create a database,
club
table with fields (coach_id, coachname, age, sports, salary, sex). Insert data for various coach records. - Additional Problem (Practical-10): Display coaches playing basketball
- Solution: Select coach names where sports is "Basketball".
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
This quiz covers various practical exercises related to SQL, including creating a student table, inserting records, and retrieving data based on conditions. You'll also learn to perform aggregate functions like counting, finding min/max, and ordering results. Test your SQL skills with hands-on examples and queries.