Comprehensive Overview of SQL: Commands and Categories

Slide Note
Embed
Share

Explore the world of Structured Query Language (SQL) through this detailed guide covering SQL categories, command classifications (DDL, DML, DCL, TCL), data manipulation and control languages, and transaction control language. Learn about creating, altering, and dropping database objects, data retrieval, insertion, updating, and deletion, as well as managing user access privileges and transaction behavior. Dive into the fundamentals of SQL to enhance your database management skills.


Uploaded on Sep 23, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. Structured Query Language(SQL) Part 1 Update Select Delete

  2. SQL CATEGORIES SQL Language (Database Management System: DBMS) MS SQL Server, My SQL, MS Access SQL DBMS PHP, Visual basic SQL 1. DDL 2. DML 3. DCL 4. TCL -Data Definition Language -Data Manipulation Language -Data Control Language -Transaction Control Language

  3. SQL Command Categories DDL DML DCL TCL GRANT REVOKE SELECT INSERT UPDATE DELETE MERGE CALL EXPLAIN PLAN LOCK TABLE COMMIT ROLLBACK SAVEPOINT SET TRANSACTION CREATE ALTER DROP TRUNCATE COMMENT RENAME https://www.w3schools.in/mysql/ddl-dml-dcl/

  4. Data Definition Language (DDL) Data Definition Language (DDL) (CREATE Table) , (DROP Table) CREATE : to create database and its objects like (table, index, views, store procedure, function and triggers) ( ) ALTER : alters the structure of the existing database ( ) DROP : delete objects from the database ( ) TRUNCATE : remove all records from a table, including all spaces allocated for the records are removed COMMENT : add comments to the data dictionary RENAME : rename an object https://www.w3schools.in/mysql/ddl-dml-dcl/

  5. Data Manipulation Language (DML) Data Manipulation Language (DML) (Database) SELECT retrieve data from the a database INSERT insert data into a table UPDATE updates existing data within a table DELETE Delete all records from a database table MERGE UPSERT operation (insert or update) CALL call a PL/SQL or Java subprogram EXPLAIN PLAN interpretation of the data access path LOCK TABLE concurrency Control

  6. Data Control Language (DCL) Data Control Language (DCL) GRANT allow users access privileges to database REVOKE withdraw users access privileges given by using the GRANT command

  7. Transaction Control Language (TCL) Transaction Control Language (TCL) COMMIT commits a Transaction ROLLBACK rollback a transaction in case of any error occurs SAVEPOINT to rollback the transaction making points within groups rollback SET TRANSACTION specify characteristics for the transaction transaction

  8. Select Select field name /[*][Count(?)] From table name [Where condition] [Order by field name desc/asc] Desc Asc Select Product_name From Product Where Product_id= G001 Select * From TPS_Product Where Product_Id <>'G001 Order by field name desc

  9. Select Select * From TPS_Product Where Product_Id like '%001' Order by Product_Id asc

  10. Select Select * From TPS_Product Where Product_Id = 'G001' or Product_Id = 'G002' Or = Select * From TPS_Product Where Product_Id = 'G001' and Product_name like '%B%' And =

  11. Select Built-in Function Min ( ), Max ( ), AVG ( ), Count ( ), Sum ( ) Select count(Product_id) From TPS_Product Select Branch_No, Product_Id, Date, SUM(Total_amount) From Stage_SaleData group by DATE, Product_Id, Branch_No

  12. Delete Delete from Table_Name [Where condition] Delete From TPS_Product (!!! Table) Delete From TPS_Product Where Product_id='G001'

  13. Delete Update TableName Set FieldName=Value [Where condition] Update Product Set Product_Name='Water' (!!! Table) Update Product Set Product_Name='Water' Where Product_id='G001'

  14. Reference https://www.w3schools.in/mysql/ddl-dml-dcl/

Related


More Related Content