Elements of SQL

The SQL language comprises several elements that will be explained in more depth in subsequent chapters. These elements include the following:

  • Queries that retrieve data based on specific criteria.
  • Clauses that are components of statements or queries.
  • Predicates that are logical conditions that evaluate to true or false. These help you to narrow down the results of your queries.
  • Expressions that produce either scalar values or tables of columns and rows. Expressions are a part of predicates.
  • Statements that are queries run against a database, comprised of clauses and, optionally, expressions and predicates. 
  • White space that is generally ignored in SQL statements and queries, making it easier to format for readability because you don't have to worry so much about particular spacing for the SQL to run correctly. 

The following diagram shows you the components of a SQL statement, which is also called a SQL query:

In the preceding diagram, you can see the different elements of a SQL statement. Each line in the preceding statement is considered a clause. Clauses use SQL keywords. Keywords are reserved words that have special significance in the SQL language—SELECT, FROM, and WHERE are just some of the keywords that are used. More information on keywords is provided in Chapter 4, Designing and Creating a Database. The preceding diagram also shows an expression and predicate. A predicate helps you to narrow down your query results. The expression is a piece of a predicate that sets the value. The diagram also helps to illustrate the use of white space. You could write out your entire query on one line, but it's much easier to read when you add carriage returns and spaces. The details of the different elements of queries will be covered more in future chapters of this book. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.19.75.133