I'm trying to answer the following questions for a homework assignment. Can you help?
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
In a SQL statement, the SELECT clause is used to select
(d) none of the above
In a SQL statement the FROM clause is used to select
(a) which rows to extract from the table
(b) which tables to extract data from
(c) which conditions must be met to choose data to extract
(d) b and c
The answers were not in any of my material. So it's possible that I'm supposed to go outside for answers. Thank you very much.
Your honesty in identifying these as homework questions is appreciated. Students who try to disguise their questions invariably receive no reply at all from me. However, you are really stretching the bounds of credibility in your closing paragraph. The answers to those questions are in your material, assuming that your material is even the most basic of SQL tutorials, and not a fennel soup recipe.
For the first question, consider the following query:
select char(34,72,101,108,108,111 ,32,87,111,105,108,100,34) as message
Is this a column? In the strictest sense, yes. But notice that it is not a column in any table. In fact, there is no table in the query, is there. Still, (a) sounds right.
But what about this query:
select sum(case when gender = 'F' then salary * 0.15 end) as total_raise_amount from employees
Is this SELECT clause not selecting rows? Most definitely, eh. So, (b) sounds right.
Then there's this query:
select * from customer_orders
If that's not selecting an entire table, then what's it doing? Thus, (c) sounds right.
So for the first question, (a), (b), and (c) all sound right, which makes (d) wrong. Does that help?
For the second question, similar examples can be given. The FROM clause selects all rows from the table, which makes (a) correct. It definitely identifies which tables to extract data from, which makes (b) correct. And the FROM clause can also have join conditions (using the ON keyword), so that makes (c) correct. Therefore (d) is also correct. Does that help?
Dig Deeper on Oracle and SQL
Related Q&A from Rudy Limeback
Read an example of an SQL case expression from our SQL expert Rudy Limeback.continue reading
Read about the Mimer Validator, a tool used to verify your SQL code, in this tip from SQL expert Rudy Limeback.continue reading
Read SQL expert Rudy Limeback's advice for counting combinations in a table with SQL's GROUP BY clausecontinue reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.