Basics of SQL

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. Etymology SQL stands for Structured Query Language. A query is a […]

Written By Avanka IT

On October 10, 2018
"

Read more

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.

Etymology

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’.

Usage

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.

Variants

There are many variants of SQL.

Four popular variants are.

1) mySQL

2) SQL Server

3) Oracle SQL

4) PostgreSQL

Syntax

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.

Example:

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

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

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.

Conclusion

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.

Reference

5 1 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments