Skip to main content
Engineering LibreTexts

6.6: Introduction to Structure Query Language (SQL)

  • Page ID
    93665
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    SQL is the universal query language of relational database management systems (DBMS) that is almost always behind user-friendly GUIs. In this section, we will briefly talk about SQL queries. We will visit SQL in more detail in later chapters.

    SQL statements can also include a SQL comment, which is a block of text used to document the SQL statement but not executed as part of the statement. SQL comments are enclosed in the symbols /* and */, and any text between these symbols is ignored when the SQL statement is executed. Here is an example:

    /* SQL-Query-Ch02 */

    The fundamental statement of SQL query can apply to Microsoft Access, SQL Server, Oracle Database, and MySQL. The basic form of SQL queries uses SQL SELECT – FROM – WHERE framework. Here are some basic specifications:

    • The SQL SELECT statement specifies which columns are to be listed in the query results.
    • The SQL FROM statement specifies which tables are to be listed in the query results.
    • The SQL WHERE statement specifies which rows are to be listed in the query results.

    Reading Specified Columns from Single Table – to obtain values from the SKU_Data table, we write a SQL SELECT statement that contains all of the column names in the table:

    /* SQL-Query-Ch_02 */


    Screenshot 2023-03-06 at 1.47.01 PM.png

    Below is a SQL queries from a single table, which obtains just the value of the Department and Buyer columns of the SKU_Data table:


    Screenshot 2023-03-06 at 1.47.19 PM.png

    The Catalog_SKU_2019 table shows DateOnWebSite. To see these items, we use the follow query: /* SQL-Query-Ch_02 */ 


    Screenshot 2023-03-06 at 1.47.40 PM.png

    6.6: Introduction to Structure Query Language (SQL) is shared under a not declared license and was authored, remixed, and/or curated by LibreTexts.

    • Was this article helpful?