This section takes you through some example syntax for selecting data in MySQL. For more details on this syntax, visit Chapter 6, Querying a Single Table; Chapter 7, Querying Multiple Tables; and Chapter 10, Grouping and Summarizing Data. These chapters will also outline the differences in syntax for Oracle, PostgreSQL, and SQL Server.
SQL for selecting data
Syntax for selecting data
To select all columns from one table, you can use the following sample syntax:
SELECT * FROM tablename;
To select one or more columns from one table, you can use the following sample syntax:
SELECT col1, col2, col3 FROM tablename;
To select from a specified database, you can use the following sample syntax:
USE databasename;
SELECT col1,...