Table of Contents
lass 12 Important Questions Chapter 11 SQL Functions and Table Joins – Question with Answer
1. What is an SQL function?
Answer: An SQL function is a predefined command that performs a specific operation and returns a single value.
2. Differentiate between single-row and multiple-row functions.
Answer: Single-row functions operate on individual rows and return one result per row, such as string or mathematical functions. Multiple-row functions, also known as aggregate functions, operate on groups of rows and return a single result for the group, like SUM() or AVG().
3. Name two case-manipulation functions in SQL.
Answer: UPPER() and LOWER().
4. What does the CONCAT() function do?
Answer: CONCAT() combines two or more strings into one.
5. How does the LENGTH() function work?
Answer: LENGTH() returns the number of characters in a string.
6. Explain the TRIM() function.
Answer: TRIM() removes leading and trailing spaces from a string.
7. What is the purpose of the SUBSTR() function?
Answer: SUBSTR() extracts a substring from a string, starting at a specified position.
8. Describe the INSTR() function.
Answer: INSTR() returns the position of the first occurrence of a substring within a string.
9. What does the LPAD() function do?
Answer: LPAD() pads the left side of a string with a specified character to a certain length.
10. How does the RPAD() function work?
Answer: RPAD() pads the right side of a string with a specified character to a certain length.
Also Check: CBSE Class 12 Physics Syllabus 2023-24
11. Name two mathematical functions in SQL.
Answer: ROUND() and MOD().
12. What is the use of the ROUND() function?
Answer: ROUND() rounds a number to a specified number of decimal places.
13. Explain the MOD() function.
Answer: MOD() returns the remainder of a division operation between two numbers.
14. What does the POWER() function do?
Answer: POWER() raises a number to the power of another number.
15. How does the SQRT() function work?
Answer: SQRT() returns the square root of a number.
16. Describe the ABS() function.
Answer: ABS() returns the absolute (positive) value of a number.
17. What is the purpose of the CEIL() function?
Answer: CEIL() rounds a number up to the nearest integer.
18. Explain the FLOOR() function.
Answer: FLOOR() rounds a number down to the nearest integer.
19. Name two date functions in SQL.
Answer: CURDATE() and NOW().
20. What does the CURDATE() function return?
Answer: CURDATE() returns the current date.
21. How does the NOW() function work?
Answer: NOW() returns the current date and time.
22. Explain the YEAR() function.
Answer: YEAR() extracts the year from a date.
23. What is the use of the MONTH() function?
Answer: MONTH() extracts the month from a date.
24. Describe the DAY() function.
Answer: DAY() extracts the day from a date.
25. What does the DATEDIFF() function do?
Answer: DATEDIFF() returns the difference in days between two dates.
26. Name two aggregate functions in SQL.
Answer: SUM() and COUNT().
27. What is the purpose of the SUM() function?
Answer: SUM() calculates the total sum of a numeric column.
28. How does the COUNT() function work?
Answer: COUNT() returns the number of rows that match a specified condition.
29. Explain the AVG() function.
Answer: AVG() calculates the average value of a numeric column.
30. What does the MAX() function do?
Answer: MAX() returns the maximum value in a set of values.
31. Describe the MIN() function.
Answer: MIN() returns the minimum value in a set of values.
32. What is a table join in SQL?
Answer: A table join combines rows from two or more tables based on a related column between them.
33. Name the different types of joins in SQL.
Answer: INNER JOIN, LEFT JOIN (or LEFT OUTER JOIN), RIGHT JOIN (or RIGHT OUTER JOIN), and FULL JOIN (or FULL OUTER JOIN).
34. Explain an INNER JOIN.
Answer: An INNER JOIN returns only the rows that have matching values in both tables.
35. What is a LEFT JOIN?
Answer: A LEFT JOIN returns all rows from the left table and the matched rows from the right table. If no match is found, NULL values are returned for columns from the right table.
36. Describe a RIGHT JOIN.
Answer: A RIGHT JOIN returns all rows from the right table and the matched rows from the left table. If no match is found, NULL values are returned for columns from the left table.
FAQs
What are SQL table joins?
SQL table joins are used to combine rows from two or more tables based on a common column.
What is SQL JOIN Class 12?
In Class 12, SQL JOIN refers to a method of combining data from multiple tables using a common key.
What are the 4 types of joins in SQL?
The four types of SQL joins are INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN.
What is SQL Class 12 IP?
SQL (Structured Query Language) in Class 12 IP (Informatics Practices) is used to manage and query databases.
What are the aggregate functions in SQL Class 12?
Aggregate functions in SQL include SUM(), AVG(), COUNT(), MAX(), and MIN., used to perform calculations on data.
What is JOIN in SQL Class 12?
A JOIN in SQL is used to retrieve related data from multiple tables by linking them using a common column.
What is SQL Class 12 Computer Science?
SQL in Class 12 Computer Science is a database language used for storing, managing, and retrieving data in relational databases.
Is a standard naming convention used for accessing resources over the Internet?
Yes, URL (Uniform Resource Locator) is the standard naming convention used to access resources on the internet.
What is the use of SQL in MySQL Class 12?
SQL is used in MySQL to create, modify, delete, and retrieve data from a relational database.