Sql

626
-1

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
626
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
39
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Sql

  1. 1. Focused more for my understanding.
  2. 2. <ul><li>SQL stands for Structured Query Language </li></ul><ul><li>The standardized relational database language for querying, manipulating, and updating information in a relational database </li></ul><ul><li>According to ANSI (American National Standards Institute), it is the standard language for relational database management systems. </li></ul><ul><li>The first form of SQL was called  SEQUEL </li></ul><ul><li>SQL is a simple non-procedural language </li></ul>
  3. 3. <ul><li>SQL can execute queries against a database </li></ul><ul><li>SQL can retrieve data from a database </li></ul><ul><li>SQL can insert records in a database </li></ul><ul><li>SQL can update records in a database </li></ul><ul><li>SQL can delete records from a database </li></ul><ul><li>SQL can create new databases </li></ul>
  4. 4. <ul><li>SQL can create new tables in a database </li></ul><ul><li>SQL can create stored procedures in a database </li></ul><ul><li>SQL can create views in a database </li></ul><ul><li>SQL can set permissions on tables, procedures, and views. </li></ul>
  5. 5. <ul><li>A complete command or statement written in the SQL language </li></ul><ul><li>SQL statements are used to perform tasks such as update data on a database, or retrieve data from a database </li></ul><ul><li>SQL is not case sensitive </li></ul><ul><li>Some database systems require a semicolon at the end of each SQL statement. </li></ul>
  6. 6. <ul><li>Data Manipulation Language (DML) </li></ul><ul><ul><li>SQL for retrieving and storing data. </li></ul></ul><ul><li>Data Design Language (DDL) </li></ul><ul><ul><li>SQL for creating, altering and dropping tables. </li></ul></ul>
  7. 7. <ul><li>Data Control Language </li></ul><ul><ul><li>Handles the authorization aspects of data </li></ul></ul><ul><li>Transactional Controls </li></ul><ul><ul><li>can be used to wrap around the DML operations: </li></ul></ul>
  8. 8. <ul><li>SELECT  - extracts data from a database </li></ul><ul><li>UPDATE  - updates data in a database </li></ul><ul><li>DELETE  - deletes data from a database </li></ul><ul><li>INSERT INTO  - inserts new data into a database </li></ul>
  9. 9. <ul><li>CREATE DATABASE  - creates a new database </li></ul><ul><li>ALTER DATABASE  - modifies a database </li></ul><ul><li>CREATE TABLE  - creates a new table </li></ul><ul><li>ALTER TABLE  - modifies a table </li></ul><ul><li>DROP TABLE  - deletes a table </li></ul><ul><li>CREATE INDEX  - creates an index (search key) </li></ul><ul><li>DROP INDEX  - deletes an index </li></ul>
  10. 10. <ul><li>GRANT - to allow specified users to perform specified tasks. </li></ul><ul><li>REVOKE - Viceversa. </li></ul>
  11. 11. <ul><li>BEGIN – To begin the Transaction </li></ul><ul><li>COMMIT – Accept and do the changes done by the executed statement </li></ul><ul><li>ROLLBACK – Undo and do not update the changes done by the executed statement </li></ul><ul><li>END – To end the Transaction </li></ul>
  12. 12. <ul><li>To retrieve or update data from multiple table, JOIN’s are used. </li></ul><ul><li>The JOIN keyword is used in an SQL statement to query data from two or more tables, based on a relationship between certain columns in these tables. </li></ul>
  13. 13. <ul><li>JOIN : Return rows when there is at least one match in both tables </li></ul><ul><li>LEFT JOIN : Return all rows from the left table, even if there are no matches in the right table </li></ul><ul><li>RIGHT JOIN : Return all rows from the right table, even if there are no matches in the left table </li></ul><ul><li>FULL JOIN : Return rows when there is a match in one of the tables </li></ul>
  14. 14. <ul><li>Inner Join - An inner join requires each record in the two joined tables to have a matching record. </li></ul><ul><ul><li>Equijoin - is a specific type of comparator-based join </li></ul></ul><ul><ul><li>Natural join - The resulting joined table contains only one column for each pair of equally-named columns. </li></ul></ul><ul><ul><li>Cross Join -  A cross join returns the cartesian product of the sets of records. </li></ul></ul>
  15. 15. <ul><li>Outer Join - An outer join does not require each record in the two joined tables to have a matching record. </li></ul><ul><ul><li>Left Outer Join </li></ul></ul><ul><ul><li>Right Outer Join </li></ul></ul><ul><ul><li>Full Outer Join </li></ul></ul><ul><li>For a table to qualify as  left  or  right  its name has to appear after the FROM or JOIN Keyword respectively </li></ul>
  16. 16. <ul><li>SELF JOIN - A self-join is joining a table to itself. </li></ul>
  17. 17. <ul><li>Learn SQL </li></ul><ul><li>Joins </li></ul>

×