Chapter library
Structured Query Language · Class XII · Part B
Open an answer to check your recall, or turn this topic into an MCQ quiz.
Database Concepts
Structured Query Language
Practice this chapter
1 Explain “SELECT” with an example.
SELECT gets chosen data from one or more tables.
Database concepts solve different problems: identifying a row, connecting tables, limiting values and retrieving results. State which problem the question describes before choosing a database feature or clause. WHERE filters rows before grouping. GROUP BY combines rows with the same grouping values. HAVING filters grouped results.
Example. An online shop keeps product names and prices in a Product table and records purchases separately. A query can show quantities by category without changing stored records. Unique IDs and valid references help the shop join the correct rows.
The important point is what “SELECT” does in a specific situation. To see the difference between this idea and the others in this chapter, compare what each one affects and which result would show that it had been used correctly. Use one concrete detail, such as a number, file name, message or action, to show exactly what you mean and how someone could check it.
160 words
2 Explain “WHERE” with an example.
WHERE filters rows before grouping.
Database concepts solve different problems: identifying a row, connecting tables, limiting values and retrieving results. State which problem the question describes before choosing a database feature or clause. GROUP BY combines rows with the same grouping values. HAVING filters grouped results. ORDER BY sorts returned rows.
Example. In SELECT name FROM Student WHERE score > 70, the WHERE clause keeps only students with marks above 70. Someone with exactly 70 is excluded by the greater-than sign. Use >= if the result should include the boundary value.
The important point is what “WHERE” does in a specific situation. To see the difference between this idea and the others in this chapter, compare what each one affects and which result would show that it had been used correctly. Use one concrete detail, such as a number, file name, message or action, to show exactly what you mean and how someone could check it.
154 words
3 Explain “GROUP BY” with an example.
GROUP BY combines rows with the same grouping values.
Database concepts solve different problems: identifying a row, connecting tables, limiting values and retrieving results. State which problem the question describes before choosing a database feature or clause. HAVING filters grouped results. ORDER BY sorts returned rows. INNER JOIN returns paired rows satisfying a join condition.
Example. An online shop keeps product names and prices in a Product table and records purchases separately. A query can show quantities by category without changing stored records. Unique IDs and valid references help the shop join the correct rows.
The important point is what “GROUP BY” does in a specific situation. To see the difference between this idea and the others in this chapter, compare what each one affects and which result would show that it had been used correctly. Use one concrete detail, such as a number, file name, message or action, to show exactly what you mean and how someone could check it.
161 words
4 Explain “HAVING” with an example.
HAVING filters grouped results.
Database concepts solve different problems: identifying a row, connecting tables, limiting values and retrieving results. State which problem the question describes before choosing a database feature or clause. ORDER BY sorts returned rows. INNER JOIN returns paired rows satisfying a join condition. COUNT(*) counts rows including rows containing nulls.
Example. If a report groups sales by category, HAVING SUM(amount) > 1000 filters the category totals. First the rows are grouped and each sum is calculated. Only groups with totals greater than 1,000 then appear in the result.
The important point is what “HAVING” does in a specific situation. To see the difference between this idea and the others in this chapter, compare what each one affects and which result would show that it had been used correctly. Use one concrete detail, such as a number, file name, message or action, to show exactly what you mean and how someone could check it.
157 words
5 Explain “ORDER BY” with an example.
ORDER BY sorts returned rows.
Database concepts solve different problems: identifying a row, connecting tables, limiting values and retrieving results. State which problem the question describes before choosing a database feature or clause. INNER JOIN returns paired rows satisfying a join condition. COUNT(*) counts rows including rows containing nulls. DISTINCT removes duplicate result rows.
Example. In an assessment query, ORDER BY score DESC puts higher scores before lower scores. This clause changes the order of the result. Use WHERE when you also need to limit which rows can appear.
The important point is what “ORDER BY” does in a specific situation. To see the difference between this idea and the others in this chapter, compare what each one affects and which result would show that it had been used correctly. Use one concrete detail, such as a number, file name, message or action, to show exactly what you mean and how someone could check it.
155 words
6 Explain “INNER JOIN” with an example.
INNER JOIN returns paired rows satisfying a join condition.
Database concepts solve different problems: identifying a row, connecting tables, limiting values and retrieving results. State which problem the question describes before choosing a database feature or clause. COUNT(*) counts rows including rows containing nulls. DISTINCT removes duplicate result rows. SELECT gets chosen data from one or more tables.
Example. An online shop keeps product names and prices in a Product table and records purchases separately. A query can show quantities by category without changing stored records. Unique IDs and valid references help the shop join the correct rows.
The important point is what “INNER JOIN” does in a specific situation. To see the difference between this idea and the others in this chapter, compare what each one affects and which result would show that it had been used correctly. Use one concrete detail, such as a number, file name, message or action, to show exactly what you mean and how someone could check it.
164 words
7 Explain “COUNT(*)” with an example.
COUNT(*) counts rows including rows containing nulls.
Database concepts solve different problems: identifying a row, connecting tables, limiting values and retrieving results. State which problem the question describes before choosing a database feature or clause. DISTINCT removes duplicate result rows. SELECT gets chosen data from one or more tables. WHERE filters rows before grouping.
Example. An online shop keeps product names and prices in a Product table and records purchases separately. A query can show quantities by category without changing stored records. Unique IDs and valid references help the shop join the correct rows.
The important point is what “COUNT(*)” does in a specific situation. To see the difference between this idea and the others in this chapter, compare what each one affects and which result would show that it had been used correctly. Use one concrete detail, such as a number, file name, message or action, to show exactly what you mean and how someone could check it.
159 words
8 Explain “DISTINCT” with an example.
DISTINCT removes duplicate result rows.
Database concepts solve different problems: identifying a row, connecting tables, limiting values and retrieving results. State which problem the question describes before choosing a database feature or clause. SELECT gets chosen data from one or more tables. WHERE filters rows before grouping. GROUP BY combines rows with the same grouping values.
Example. An online shop keeps product names and prices in a Product table and records purchases separately. A query can show quantities by category without changing stored records. Unique IDs and valid references help the shop join the correct rows.
The important point is what “DISTINCT” does in a specific situation. To see the difference between this idea and the others in this chapter, compare what each one affects and which result would show that it had been used correctly. Use one concrete detail, such as a number, file name, message or action, to show exactly what you mean and how someone could check it.
161 words
9 Distinguish between SELECT and WHERE.
SELECT gets chosen data from one or more tables. WHERE filters rows before grouping.
Database concepts solve different problems: identifying a row, connecting tables, limiting values and retrieving results. State which problem the question describes before choosing a database feature or clause. GROUP BY combines rows with the same grouping values. HAVING filters grouped results. ORDER BY sorts returned rows.
Example. An online shop keeps product names and prices in a Product table and records purchases separately. A query can show quantities by category without changing stored records. Unique IDs and valid references help the shop join the correct rows.
Compare the two ideas using the same situation. Describe which part of the situation each idea explains and how the result would differ if you used the other one. This gives the distinction a clearer basis than listing two definitions in isolation. Use one concrete detail, such as a number, file name, message or action, to show exactly what you mean and how someone could check it.
167 words
10 A Sales table has category and amount columns. Write a query that shows categories whose total sales exceed 1000.
Use SELECT category, SUM(amount) AS total FROM Sales GROUP BY category HAVING SUM(amount) > 1000. GROUP BY collects rows of each category, and HAVING filters the resulting totals.
Database concepts solve different problems: identifying a row, connecting tables, limiting values and retrieving results. State which problem the question describes before choosing a database feature or clause. WHERE filters rows before grouping. GROUP BY combines rows with the same grouping values. HAVING filters grouped results.
Example. An online shop keeps product names and prices in a Product table and records purchases separately. A query can show quantities by category without changing stored records. Unique IDs and valid references help the shop join the correct rows.
Check your answer against the task. Identify the facts that matter, explain the steps in a sensible order and state the result you would expect. If your result differs from what you expected, revisit the input, condition or decision that produced it.
157 words
Reference book: 802-Information Technology Class- XII_PART_B.pdf