Search This Blog

SQL Tutorial

sql tutorial

SQL Tutorial

SQL stands for Structured Query Language and is the standard relational language that is supported by just about every database product for example Oracle, SQL Server, MySQL, MariaDB, PostgreSQL etc. SQL used to store, retrieve, and manipulate data in relational databases. All database professionals should know how to write, troubleshoot, and optimize SQL.

In this tutorial we will start with the basics of SQL, such as how to retrieve and manipulate data. Then we will move to the more advanced topics such as how to create tables and views.

This tutorial will teach you step by step to becoming proficient in writing, executing, and optimizing SQL.

Prerequisites

This tutorial don't need any prerequisites. You will be able to easily learn learn the basic concepts of SQL as you progress to the more advanced SQL topics.

Now, let's get started!

Start Tutorial

Or jump directly to a topic in SQL:

SQL Query Types

SELECT StatementRetrieve records from a table
SELECT LIMIT StatementRetrieve records from a table and limit results
SELECT TOP StatementRetrieve records from a table and limit results
INSERT StatementInsert records into a table
UPDATE StatementUpdate records in a table
DELETE StatementDelete records from a table
TRUNCATE TABLE StatementDelete all records from a table (no rollback)
UNION OperatorCombine 2 result sets (removes duplicates)
UNION ALL OperatorCombine 2 result sets (includes duplicates)
INTERSECT OperatorIntersection of 2 result sets
MINUS OperatorResult set of one minus the result set of another
EXCEPT OperatorResult set of one minus the result set of another

SQL Comparison Operators

Comparison OperatorsOperators such as =, <>, !=, >, <, and so on

SQL Joins

JOIN TablesInner and Outer joins

SQL Aliases

ALIASESCreate a temporary name for a column or table

SQL Clauses

DISTINCT ClauseRetrieve unique records
FROM ClauseList tables and join information
WHERE ClauseFilter results
ORDER BY ClauseSort query results
GROUP BY ClauseGroup by one or more columns
HAVING ClauseRestrict the groups of returned rows

SQL Functions

COUNT FunctionReturn the count of an expression
SUM FunctionReturn the sum of an expression
MIN FunctionReturn the min of an expression
MAX FunctionReturn the max of an expression
AVG FunctionReturn the average of an expression

SQL Conditions

AND Condition2 or more conditions to be met
OR ConditionAny one of the conditions are met
AND & ORCombining AND and OR conditions
LIKE ConditionUse wildcards in a WHERE clause
IN ConditionAlternative to multiple OR conditions
NOT ConditionNegate a condition
IS NULL ConditionTest for NULL value
IS NOT NULL ConditionTest for NOT NULL value
BETWEEN ConditionRetrieve within a range (inclusive)
EXISTS ConditionCondition is met if subquery returns at least one row

SQL Tables and Views

CREATE TABLECreate a table
CREATE TABLE ASCreate a table from another table's definition and data
ALTER TABLEAdd, modify or delete columns in a table; rename a table
DROP TABLEDelete a table
GLOBAL TEMP TablesTables that are distinct within SQL session
LOCAL TEMP TablesTables that are distinct within modules and embedded SQL program
SQL VIEWVirtual tables (views of other tables)

SQL Keys, Constraints and Indexes

 

Primary KeysCreate or drop primary keys
IndexesCreate and drop indexes (performance tuning)

SQL Data Types

Data TypesData Types in SQL

SQL Programming

CommentsHow to create comments within your SQL statement

 

No comments:

Post a Comment

Using SQL*Plus to Unlock Accounts and Reset Passwords

  Using SQL*Plus to Unlock Accounts and Reset Passwords Use this SQL*Plus procedure to unlock and reset user account passwords. Log in as th...