SQL commands are clear, declarative statements. SQL syntax is easy to understand, and managing data in SQL databases accurately and consistently is not a big challenge.
SQL commands are not case-sensitive, and that makes them even more convenient. Small errors like wrong capitalization won’t break your script. However, it’s a common practice to write the statements in all caps to ensure better readability. We will use this approach in our tutorials as well.
SQL Commands: Main Tips
- To interact with SQL databases, you need to use SQL commands (also called SQL statements).
- Databases are tables that consist of columns (they represent attributes of an entry) and rows (they represent individual data entries).
- SQL is not case-sensitive, but writing SQL commands in ALL CAPS improves readability of your code.
- Certain databases may require a semicolon (
;) after each statement. Usually this rule applies when you need to enter a few statements in a single call to the server.
SQL Statement Syntax Example
Let's try performing one of the most common actions in SQL – selecting certain data.
For our example, we are using a demo database, and we want to get all the records from the Customers table.
The following SQL command is all you need for this task.
SELECT * FROM Customers;
Note: The asterisk (
*) is an operator to select all the entries from the specified table.
- Easy to use with a learn-by-doing approach
- Offers quality content
- Gamified in-browser coding experience
- The price matches the quality
- Suitable for learners ranging from beginner to advanced
- Free certificates of completion
- Focused on data science skills
- Flexible learning timetable
- Simplistic design (no unnecessary information)
- High-quality courses (even the free ones)
- Variety of features
- Nanodegree programs
- Suitable for enterprises
- Paid Certificates of completion
SQL Syntax Cheet Sheet
SELECT– selects data from the database.
DELETE– removes data from the database.
UPDATE– overwrites data in the database.
CREATE DATABASE– creates a new database.
INSERT INTO– uploads new data into the database.
CREATE TABLE– creates a new table.
ALTER DATABASE– changes the attributes, files or filegroups of the database.
CREATE INDEX– creates an index, or a search key.
DROP INDEX– deletes an index.
ALTER TABLE– changes the attributes or entries of a table.
SQL Commands: Summary
- SQL commands, or SQL statements, are used to interact with SQL databases.
- Databases consist of columns (attributes of entries) and rows (individual data entries).
- Usually SQL commands are written in all caps for better readability, but SQL is not case-sensitive and all capitalization options work equally.
- You may need to use a semicolon (
;) after each statement for some databases.