Query about Queries

MatthewB

Member
Local time
Today, 09:58
Joined
Mar 30, 2022
Messages
85
When one creates a query from two tables what determines which fields one includes in the query?
 
You do. Pull in fields for whatever data you want to view.
 
The SELECT statement does. So, the query will include whichever fields you put in the SELECT clause of the SQL. If you're using the query designer, the Show checkbox will determine which fields are included.
 
The SELECT statement does. So, the query will include whichever fields you put in the SELECT clause of the SQL. If you're using the query designer, the Show checkbox will determine which fields are included.
Thanks
 
Any other clauses of SQL statement you need clarification on?
 
There are a few reasons for including given fields in a query.

You use a SELECT clause to name the fields you wish to actually show together, i.e. data to be extracted and delivered.
You use an ON clause (part of a JOIN) to name the fields that define some relationship between the participating tables.
You use a WHERE clause or HAVING clause to name fields for which you wish some selectivity to be imposed, i.e. selective inclusion or exclusion.
You use GROUP BY or ORDER BY clause to identify factors in the presentation of what you are showing when a sort or aggregation is involved.

In each case, the fields can appear in the query's clauses INDEPENDENT of whether they appear in the other clauses, with a couple of exceptions when a GROUP BY clause is involved because fields may be required in other parts of the query to support the grouping.
 
Any other clauses of SQL statement you need clarification on?
If you want to know how basic my knowledge is at present, SQL, clause?
There are things you don't know you don't know. that's where I'm at.
 
There are a few reasons for including given fields in a query.

You use a SELECT clause to name the fields you wish to actually show together, i.e. data to be extracted and delivered.
You use an ON clause (part of a JOIN) to name the fields that define some relationship between the participating tables.
You use a WHERE clause or HAVING clause to name fields for which you wish some selectivity to be imposed, i.e. selective inclusion or exclusion.
You use GROUP BY or ORDER BY clause to identify factors in the presentation of what you are showing when a sort or aggregation is involved.

In each case, the fields can appear in the query's clauses INDEPENDENT of whether they appear in the other clauses, with a couple of exceptions when a GROUP BY clause is involved because fields may be required in other parts of the query to support the grouping.
Thanks. I will read this closely later today. Are we talking visual basics when you say 'clause', as in a line of code?
 
Thanks. I will read this closely later today. Are we talking visual basics when you say 'clause', as in a line of code?
This SQL Statement has THREE clauses.

SELECT ThingOne
FROM tblOne
ORDER BY ThingOne

This SQL Statement has FOUR clauses.

SELECT ThingOne
FROM tblOne
WHERE ThingOne = 1
ORDER BY ThingOne
 
Are we talking visual basics when you say 'clause', as in a line of code?

VBA has statements usually based on keywords (DIM, PUBLIC, PRIVATE, ENUM, DECLARE, IF, THEN, ELSE, DO, WHILE, UNTIL, LOOP, END...) and the use of variables in proximity with arithmetic and logical operators to form meaningful programming formula expressions.

SQL has clauses based on use of certain keywords (SELECT, JOIN, ON, FROM, WHERE, ORDER BY, GROUP BY, HAVING, ...) and the use of table names, field names, and SOMETIMES formula expressions.
 

Users who are viewing this thread

Back
Top Bottom