The syntax of every SQL query is the same:
*Use SELECT to choose the columns you want to return.
*Use FROM to choose the tables where the columns you want are located.
*Use WHERE to filter for certain information.
How do we separate if we need to SELECT more than one column?
use ","
how do we separate if we need to WHERE more than one condition?
use "AND"
Capitalization & indentation: SQL isn't case sensitive, and you can write both lower and upper case, also you can use spaces to make the syntax more clear
semicolons: similar to M code where it is a statement terminator, but some systems don't require it.
if you are looking for all customers with a last name that begins with the letters “Ch," the WHERE clause would be
WHERE field1 LIKE 'Ch%'
or some systems uses the below
WHERE field1 LIKE 'Ch*'
What are the wildcard signs used in SQL?
usually it is "%" also some systems use "*"
How do you SELECT all in SQL?
SELECT*
you should use the asterisk (*) sparingly and with caution. Depending on how many columns a table has, you could be selecting a tremendous amount of data. Selecting too much data can cause a query to run slowly.
How do I place a comment in SQL?
similar to MCODE
When do I place the comment before the context and within the context?
before the context to provide an overall comment about the whole syntax
within the syntax if you need to provide specific comments