Easy Tutorial
❮ Sql Null Values Sql Tutorial ❯

SQL Syntax


Database Tables

A database typically contains one or more tables. Each table is identified by a name (e.g., "Websites"), and it contains records (rows) with data.

In this tutorial, we created the Websites table in the tutorialpro database of MySQL to store website records.

We can view the data of the "Websites" table with the following commands:

mysql> use tutorialpro;
Database changed

mysql> set names utf8;
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT * FROM Websites;
+----+--------------+---------------------------+-------+---------+
| id | name         | url                       | alexa | country |
+----+--------------+---------------------------+-------+---------+
| 1  | Google       | https://www.google.cm/    | 1     | USA     |
| 2  | Taobao       | https://www.taobao.com/   | 13    | CN      |
| 3  | tutorialpro.org      | http://www.tutorialpro.org/    | 4689  | CN      |
| 4  | Weibo        | http://weibo.com/         | 20    | CN      |
| 5  | Facebook     | https://www.facebook.com/ | 3     | USA     |
+----+--------------+---------------------------+-------+---------+
5 rows in set (0.01 sec)

Explanation


SQL Statements

Most of the actions you need to perform on a database are done with SQL statements.

The following SQL statement selects all records from the "Websites" table:

Example

In this tutorial, we will explain various different SQL statements.


Remember...


Semicolon after SQL Statements?

Some database systems require a semicolon at the end of each SQL statement.

The semicolon is a standard method to separate each SQL statement in database systems, allowing multiple SQL statements to be executed in the same request to the server.

In this tutorial, we will use a semicolon at the end of each SQL statement.


Some of the Most Important SQL Commands

❮ Sql Null Values Sql Tutorial ❯