Introduction to The Basics of SQL
SQL makes relational database management fun.
Here is a comprehensive guide that will help you to understand the basics of SQL.
We will do out best to cut learning fluff, and update the guide based on your input.
SQL stands for Structured Query Language.
A query is a request for information made within the server.
SQL can be pronounced using its letters individually or like the word ‘sequel’.
SQL is a relational database management system.
Information is organized and sorted in collections of tables, called a database.
SQL creates links across databases and helps to filter information between databases.
There are many variants of SQL.
Four popular variants are.
2) SQL Server
3) Oracle SQL
SQL tables are organized in columns and rows.
Columns are called fields.
Rows are called records.
Statements are used to manipulate data in tables.
Statements typically have a keyword, operator, and table name.
Photo Credits: W3Schools
Note: A semicolon may be used in some variants of SQL to designate the end fo a statement.
Clauses, Operators, and Queries
Clauses are used to manipulate data in rows.
Operators are used to assign or compare values.
Queries are used to filter information in a database.
Functions in SQL are used to filter information within tables.
Five useful functions are:
1) LENGTH —> Returns the length of a string.
2) SUM —> Sums values.
3) COUNT —> Counts the number of records in a query.
4) TIME —> Extracts the time of a particular locale.
5) CAST —> Converts a value from one datatype to another.
Keys are used to assign relationships between records in a database.
Primary keys and foreign keys are the two main types of keys in SQL.
A primary key identifies a record with a unique value in one table and compares it against other tables.
A foreign key is a field in one table that links to a primary key in another table.
SQL is a great language to use for your databases. SQL queries return information that may be used for a variety of different purposes. Avanka IT recommends all programmers learn SQL at some point in their careers.
- Introduction to SQL. (2018). Retrieved September 20, 2018, from https://www.w3schools.com/sql/sql_intro.asp
- Goldstein, J. (2005, November). Writing SQL Queries: Let’s Start with the Basics. Retrieved September 20, 2018, from https://technet.microsoft.com/en-us/library/bb264565(v=sql.90).aspx
- Chapple, M. (2018, June 24). The Fundamental Guide to SQL. Retrieved September 20, 2018, from https://www.lifewire.com/sql-fundamentals-1019780
- Basic SQL Statements. (2018). Retrieved September 20, 2018, from https://mariadb.com/kb/en/library/basic-sql-statements/
- List of SQL Commands. (2018). Retrieved September 20, 2018, from https://www.codecademy.com/articles/sql-commands