Skip to main content

SQL Commands - Basics

 

  • SQL stands for Structured Query Language
  • SQL lets you access and manipulate databases

 SQL database is a collection of tables that stores a specific set of structured data.

Database Management Systems (DBMS) are software systems used to store, retrieve and run queries on data. A DBMS serves as an interface between an end-user and a database, allowing users to create, read, update, and delete data in the database.

eg : MySQL, Oracle DB, etc. 

RDBMS stands for Relational Database Management System. RDBMS is a program used to maintain a relational database. RDBMS uses SQL queries to access the data in the database.

Types of Commands Available in SQL : 

  • Data Definition Language 
  • Data Manipulation Language 
  • Data Query Language 
  • Data Control Language 
  • Transactional Control Language 

 Data Definition Language : Set of commands used to create and modify the structure of database objects in a database.

  • create, alter, drop, truncate

Create :  To create a database and table. 


Alter :
To add, change, modify or drop columns in an existing table. 


 
  

 

 


 

 

 

 

 


 

 

 

 

 

Truncate: To delete the data inside a table but not the table itself (retains structure of the table)


 


 

 

Drop:  To remove/delete an entire table. 


 

 Data Manipulation Language :  A set of commands used to add (insert), delete (delete), and alter (update) data in a database. 

  • insert, update, delete

Insert: To add new records/rows in a table 

Syntax


 

 

Update:  Modifies existing records in a table based on a condition specified by where clause



 

 

Delete: Deletes existing rows in a table


 

 

Data Query Language :   Commands used to make various queries in the table

  • select
Select: To retrieve/query an SQL table

Basic Syntax

 

 

Data Control Language:  Allows to set up and control BigQuery resources using GoogleSQL query syntax.

  • grant, revoke  
Grant: To provide access or privileges on the database objects to the users. 
 

 
 
 
 
 
 
An entity contained within a database is an object, eg: tables 
 
Revoke: To revoke granted permissions/privileges 

 
 
 
 
Transactional Control Language :  Used to allow/administer changes to DML commands, in effect governing transactions. 
  • commit, rollback 
Commit : Ends the transaction to save the transaction changes to  physical data files. There is no option to undo the transaction after a commit is issued. 
                 Syntax: 
                                 
                                  ----------SQL statements------------
                                  commit; 
 
Rollback: In a realtime transaction, up until a commit is executed there is an option to rollback a transaction so that the actual data can be retained.
              Syntax: 
                             
                             ----------------SQL statements------------
                             rollback; 
 
[DCL and TCL  query languages are used in advanced/realtime applications]
 
 
 
                                                                                                                                                             
  

Popular posts from this blog

Case Study: Reported Rape Cases Analysis

Case Study  : Rape Cases Analysis Country : India Samples used are the reports of rape cases from 2016 to 2021 in Indian states and Union Territories Abstract : Analyzing rape cases reported in India is crucial for understanding patterns, identifying systemic failures and driving policy reforms to ensure justice and safety. With high underreporting and societal stigma, data-driven insights can help reveal gaps in law enforcement, judicial processes and victim support systems. Examining factors such as regional trends, conviction rates and yearly variations aids in developing more effective legal frameworks and prevention strategies. Furthermore, such analysis raises awareness, encourages institutional accountability and empowers advocacy efforts aimed at addressing gender-based violence. A comprehensive approach to studying these cases is essential to creating a safer, legally sound and legitimate society. This study is being carried out with an objective to perform descriptive a...

Everything/Anything as a Service (XaaS)

  "Anything as a Service" or "Everything as a Service."     XaaS, or "Anything as a Service," represents the comprehensive and evolving suite of services and applications delivered to users via the internet. This paradigm encompasses a wide array of cloud-based solutions, transcending traditional boundaries to include software, infrastructure, platforms and more. There are numerous types of XaaS: Software as a service Platform as a service Infrastructure as a service Storage as a service Mobility as a service Database as a service Communications as a service Network as a service  .. and this list goes on by each passing day  Most familiar and known services in Cloud Computing : Software as a service ...

The light weight distro : Alpine

    Ever since its inception in DockerCon in 2017, this light weight Linux distro has been gaining some popularity.  With a light weight ISO image (9 Mb -> Alpine:latest) and the fastest boot time (12 sec), this Linux distribution is doing its own rounds. But why ? Well to begin with, one of its nearest neighbor ISOs weigh almost 77Mb (Ubuntu:latest), as anyone can see that's one huge difference.  Secure, lightweight, fastest boot time, perfect fit for container image s and even for running containers across multiple platforms due to its light weight.. but how does Alpine Linux achieves it all. Lets look into its architecture:  Core Utilities:  Musl libc: Alpine Linux uses musl libc instead of the more common GNU C Library (glibc). Musl is a lightweight, fast and simple implementation of the standard C library, a standards-compliant and optimized lib for static linking and minimal resource usage. Busybox:  BusyBox combines tiny versions of many comm...