≡ Menu

Best Books for Beginners to Learn SQL

SQL is a integral part of person who deals with data, no matter if you are programmer, data analysts or a end user, you would find learning SQL is important to execute your day to day tasks. SQL is the standard of querying your corporate database to get the insight information hidden in the storage. best way to learn SQL is either get best book on SQL and start learning by reading by following examples given or directly start exploring the data base by executing queries.

Database vendors do have their own flavors of SQL, however most of them are SQL-92 compliant with few extra functions.

Below are the recommended books to learn SQL. These books are highly recommended on for everyone who wants to dig deeper in SQL.

Sql: Learn SQL In A DAY! – The Ultimate Crash Course to Learning the Basics of SQL In No Time (SQL, SQL Course, SQL Development, SQL Books)

If you are short of time and you just need to learn SQL basic to query some data and not interested in advance topics of SQL then

SQL in 10 Minutes, Sams Teach Yourself (4th Edition)

SQL in 10 Minutes is another books to learn SQL fast however dont go by its name and its takes little more time than 10 minutes to get started with SQL.

Some more best books on SQL

SQL in a Nutshell is a desktop reference book and don’t try to complete it by reading page by page. Instead start exploring SQL by using its constructs and use this book as a reference point. A must have in your book shelf.

SQL Bible This book is for absolute beginner. It starts from very basic concepts of SQL and goes up to intermediate level. Its very good for beginners as it has lots of examples which you can practice

SQL Tutorial – INSERT INTO

In create table statement we saw how to create table, create table with constraints etc.In this tutorial we we will see how to insert a data into tale using INSERT INTO statement.

Once you have table ready, you need to use INSERT INTO statement to insert records in it.

Syntax:

INSERT INTO VALUES (Value1,value2...)

If you are inserting same number of records as number of column names you can omit the column part, however it should be in the same order of column created in table.

If you are not sure about column names in table you can use DESCRIBE to view table structure

e.g.

CREATE TABLE employees_demo
( employee_id NUMBER(6)
, first_name VARCHAR2(20)
, last_name VARCHAR2(25)
CONSTRAINT emp_last_name_nn_demo NOT NULL
);

INSERT INTO employees_demo VALUES (1,”Chuck”,”Norris”);

If you try to only insert data in two column

INSERT INTO employees_demo (employee_id,first_name) VALUES (1,"Chuck","Norris");

It will through error as we have defined last_name column to be not null.

If you want to leave first_name column empty you can specify only two column in insert statement as

INSERT INTO employees_demo (employee_id,last_name) VALUES (1,"Norris");

SQL Create Table

Table are the basic building blocks of RDBMS. Tables in DBMS are two dimensional data structure which holds data in the for of rows and column. Table has columns which holds data of specific data data type e.g string, number etc.

In order to create table, user needs to have create table permission.

CREATE TABLE (
<(Size)> [CONSTRAINT ],
<(Size)> [CONSTRAINT ]
----
);

Column Name: Name of column alphanumeric characters are allowed should start with character.
Data Type: Specify data type of column like number, string
Constraint: Name of constraint you want to apply on column like NOT NULL,UNIQUE.

e.g.

CREATE TABLE employees_demo
( employee_id NUMBER(6)
, first_name VARCHAR2(20)
, last_name VARCHAR2(25)
CONSTRAINT emp_last_name_nn_demo NOT NULL
);

In next SQL Tutorial will be covering INSERT statement to insert data in newly created table.

SQL Tutorial – Introduction

SQL stands for Structured Query Language (pronounced sequel). SQL is a language to retrieve, view, process data stored in database. SQL has its own standard set by ANSI however every database product has its own flavour.

Since most of the database vendor also follow ANSI SQL syntax, We will be using mix of Oracle and ANSI SQL syntax in SQL tutorials. So, Let’s start learning SQL.

Categories of SQL statements:

SQL have many commands to control, process, and view data. These commands can be categories in following categories.

DDL (Data Definition Language) – Commands under this category are used to define the physical structure of table, views and other database objects.

Following commands falls under this category.

CREATE TBALE

CREATE VIEW
DROP TABLE

DROP VIEW

Etc…

DML (Data Manipulation Language) – Commands under this category are used to manipulate and process data stored in database.

Following commands fall under this category.

SELECT

INSERT

UPDATE

DELETE

DCL (Data Control Language) – Commands under this category are used to control the access to data stored in database.

Following statements fall under this category.

GRANT

REVOKE

TCL (Transaction Control Language) – Commands under this category are used to control the changes made my DML statements basically it controls the transaction triggered by DML.

Following commands fall under this category

COMMIT

ROLLBACK

SAVEPOINT

Etc.