SELECT, WHERE & ORDER BY · Question 2 · Easy
In the query below, what is stock_value?
SELECT name, price * stock AS stock_value
FROM Products;
- A new column that is permanently added to the Products table
- A table alias that can be used in place of Products
- A column alias: a name for the computed column in this query's result only
- A variable that keeps its value for later queries in the session
Answer and explanation
Answer: C. A column alias: a name for the computed column in this query's result only
Explanation: AS gives the expression price * stock a name in the result set. Nothing is stored: the table is unchanged and the name does not exist outside this query.
Previous: Table Students: roll | name | city | marks 1 | Aarav | Pune | 78 2 | Diya |… · Next: Table Products: pid | name | category | price | stock 1 | Kurta | Clothing |…
Practise select, where & order by
Try a fresh set of select, where & order by questions with an explanation after every answer, free and without signing up: SELECT, WHERE & ORDER BY practice. Or sit a full placement mock test.
More select, where & order by questions
- Table Students: roll | name | city | marks 1 | Aarav | Pune | 78 2 | Diya |…
- Table Products: pid | name | category | price | stock 1 | Kurta | Clothing |…
- Table Payments: txn_id | payer | app | amount | status 1 | Farhan | GPay | 250…
- Table Students: roll | name | city | marks 1 | Aarav | Pune | 78 2 | Diya |…
- Table Products: pid | name | category | price | stock 1 | Kurta | Clothing |…
- Table Products: pid | name | category | price | stock 1 | Kurta | Clothing |…
- Table Products: pid | name | category | price | stock 1 | Kurta | Clothing |…
- Table Students: roll | name | city | marks 1 | Aarav | Pune | 78 2 | Diya |…
- Table Students: roll | name | city | marks 1 | Aarav | Pune | 78 2 | Diya |…
- Table Payments: txn_id | payer | app | amount | status 1 | Farhan | GPay | 250…
More sql practice
SQL Joins · Aggregates & GROUP BY · Subqueries & CTEs · Window Functions · NULL Handling · SQL Functions & CASE · UNION, INTERSECT & EXCEPT · Tables, Keys & Constraints
LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge