A Beginner's Guide to SQL

Thumb

A Beginner's Guide to SQL

SQL was originally developed at IBM by Donald D. Chamberlin & Raymond F. Boyce after knowing about the relational model from Ted Codd in the early 1970s. This version initially called SEQUEL (Structured English Query Language) and was changed later to SQL (Structured Query Language). It is a programming language used by programmers to communicate with databases.

An application if dealing with any data must store that data at someplace, whether it's a big database with multiple servers or a mobile phone with a small database, or just a table with few rows.

So why learn an entirely new language when there are other tools available for writing SQL queries visually? It is very much significant to know the SQL language and to understand how these visual tools are working. Sometimes there is a need to write a few SQL statements manually because it is more powerful and sometimes the only way to achieve targeted goals.

Let's discuss common terms used in SQL required for beginners.

What is a Database?

SQL is the language of databases. The database is a storage mechanism designed to provide access to stored information and their manipulation. Information in the database is kept in objects i.e., tables.

Tables are uniquely known by their names to consist of columns and rows. Columns include a column name, column data type. The column is known as a field that defines a row. Rows consist of data for the columns, and each row is known as a record.

Suppose there is a table i.e. "Employee" table. In this employee table, each row is a unique person, and fields like name, address, and department describe this employee.

Relational databases

It is a structural form of database that keep data in tables, and these tables are somehow  linked to one other. Suppose the Employee table can be linked to a Department table. The relation here can be seen that is a particular employee who belongs to a department.

Three important keywords; SELECT, FROM and WHERE

There are many keywords used in SQL, but SELECT, FROM, and WHERE are the ones to be used in almost every query and every database table that you create. These keywords signify the necessary aspect of querying a database, and other complex queries are simply extensions of them.

FROM

To fetch the data from a particular table i.e. the name of the table is shown after From keyword.

WHERE

It is related to the data to show in the table. Filter out the rows that you want to show. If the user wants to show all the student rows having age up to 30 years so only those rows will be shown.

SELECT

It is about selecting the columns of the tables such as Student_Name or Student_Age and displaying the rows according to it.

SQL Queries

Queries can be classified as DML (Data Manipulation Language) and DDL (Data Definition Language).

DDL commands

CREATE:

To create a new table in a particular database

Create table Interns

Alter:

It is multi-functional statements that can add/modify/drop/rename a column or a table.

Alter table Interns Add (EmpNo int) - Adds new column EmpNo

Drop:

Used to remove table definitions, including all the data.

Drop table Interns

DML queries

Select:

Use this query to display a collection of records. It is similar to the 'print' statement in programming languages.

Select * from Student -- Get all the records from Student table

Insert:

It is to insert data into a table.

Insert into Student (StdNo,)Values (104)

Update:

To update existing values in a table.

Update Employee set DeptNo = 10 

Delete:

Used to delete records from a table.

Delete from Employee where EName = 'Sultan'

Most common SQL database systems

The database system is a program that allows a developer to work with databases with the aid of a user interface. Let's see the most common SQL database systems.

ORACLE DATABASE

Oracle is one of the most prominent SQL database system in the world. It's used in a lot of industries but is mainly popular in data warehousing & online transaction processing.

MYSQL

MYSQL is an open-source database system that is provided for free to individuals and businesses. It's common with small businesses and startups due to its no license fee feature. It is used in open-source software programs and applications.

MICROSOFT SQL SERVER

It is Microsoft's bespoke SQL database management system. This database runs on all main versions of Windows operating systems. It is used in consumer software as well as on web servers that run Windows. It has a big user base.

POSTGRESQL

PostgreSQL is also a free, open-source database system and a major competitor to MySQL. It's used a lot by technology startups for its free licensing model. It supports major operating systems–macOS, Windows, and Linux. It emphasizes greatly on following of standard SQL syntax than other databases.

Picking a database system seems a thought-provoking process when given with so many good choices. If you are in doubt, choose free, open-source options like MySQL or PostgreSQL.

WHERE TO ASK FOR HELP

In the programming journey, there will be times where a programmer can get stuck on SQL or coding problems. An online course is one of the best ways to get help such as the following:

Microsoft transact SQL certification

few objectives are listed below:

  • Describe key components and know-how of SQL server.
  • Ability to create a solitary table or multi-table. Select command with filtering and sorting.
  • Creating and executing views and table-valued functions.
  • Compose queries and sub-queries.
  • Make and execute stored procedures.

Targeted Audience

  • Database Administrator
  • Database Developers
  • BI experts

SQL is in demand and used by many companies in nearly every industry. It might be difficult to learn a new language at the start, but it can lead programmers with many database jobs in this phenomenal field.

Previous Post Next Post
Hit button to validate captcha