Oracle SQL in 10 Minutes - Asim Abbasi

CH1: SQL Basics | CH2:  SQL Operators | CH3:  SQL Built-in Functions | CH4: SQL Joins | CH5: UPDATE, INSERT & DELETE Statements | CH6: CREATE, ALTER & DROP Statements | CH7: Constraints | CH8: Linking Tables vs Joining Tables | CH9: SQL Statements for Other Database Objects | CH10: SQL Statements for Database Security

Chapter 1: SQL Basics

Page #: 1 | 2 | 3 | 4


Once you see a database product saying its RDBMS it means it uses SQL as a language and data inside it is written always in table form i.e. rows/records & columns/fields. Moreover there may or may not be relationship in-between those tables.

Each of the RDBMS Database manufacture has their own version of SQL. But they all are more than 90% alike. If it takes you to learn Oracle SQL in a week after that you can learn SQL for MS SQL server in less than an hour. There is one SQL standard defined by ANSI (American National Standard Institute) and is called ANSI SQL. Nearly all RDBMS database manufacture incorporates this ANSI SQL and then builds a layer of some new stuff on top of it to provide added functionality in the language. The SQL that we will be learning in this book will be more precisely Oracle SQL.

Concept of arranging the data in the form of table is very simple. We have been doing it on the papers for years and the concept is still the same. There are two terms that we will be using a lot. One is called “Record(s)” or “Row(s)” and other one is called “Field(s)” or “Column(s)”. Like shown in the figure below, there are 5 records in the table and 3 fields. Each field in Oracle table has been assigned a “Data type”. While creating a table if you have assigned DOB (Date of Birth) field “date” data type, you cannot insert characters in it or you cannot insert numeric value in it. We will learn this stuff in great detail when we learn about CREATE TABLE statement.

There is one more thing that we can do with fields, we can assign constraints to them e.g. If you assign UNIQUE constraint to any column then you would not be able to insert any value in it which is already their in the same column. Constraints help in maintaining the data integrity of the system.

 

Table Showing Records/Rows And Fields/Columns
________________________________________


SQL is nothing but a set of commands/statements and are categorized into following five groups viz., DQL: Data Query Language, DML: Data Manipulation Language, DDL: Data Definition Language, TCL: Transaction Control Language, DCL: Data Control Language.

DQL: SELECT
DML: DELETE, INSERT, UPDATE
DDL: CREATE, DROP, TRUNCATE, ALTER
TCL: COMMIT, ROLLBACK, SAVEPOINT
DCL: GRANT, REVOKE


Once we finish up with SQL you will say to yourself, “Oh! That was easy”. Let’s start with the following example.

SELECT name, phone, city
FROM address_book;
 

Chapter 1: Overview

Page #: 1 | 2 | 3 | 4

CH1: SQL Basics | CH2:  SQL Operators | CH3:  SQL Built-in Functions | CH4: SQL Joins | CH5: UPDATE, INSERT & DELETE Statements | CH6: CREATE, ALTER & DROP Statements | CH7: Constraints | CH8: Linking Tables vs Joining Tables | CH9: SQL Statements for Other Database Objects | CH10: SQL Statements for Database Security