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...

Trials vs. Internet Vigilantism : Authoritative View

  1. In an era of internet vigilantism, would there be any impact on a fair trial due to interference of social media and public platforms ?  Ans. It depends on many factors. Social media can create public opinion based on half truths or misinformation, which can pressurize a judge to interpret evidence especially in a 50-50% chance case, in tune with the public opinion. A wavering judge may align his/her decision in favor of public opinion, lest he/she should be adversely criticized. But a trained judicial mind will not be influenced by external factors, but will be guided by the proof appearing from the evidence adduced in the case under trial. He/she will not succumb to the pressure exerted by social media. Similar is the case of prosecutors and investigators. Social media can easily affect a layman witness. It can affect the privacy of vulnerable victims also. Thus trial by media is a social evil. 2. With the rise of digital tools, how has the use of technology like digit...

Artificial Intelligence on Cloud - Benefits and Challenges

      Why Cloud ?    Cloud computing is a paradigm in computing that involves the delivery of various computing services including storage, processing power and applications over the internet . Instead of relying on local servers or personal computers to handle computing tasks, users can access and utilize a shared pool of resources provided by third-party service providers. These services are hosted in remote data centers commonly referred to as the "cloud" and are made available to users on a pay-as-you-go or subscription basis. Cloud computing encompasses a range of services, including Infrastructure as a Service (IaaS), Platform as a Service (PaaS), and Software as a Service (SaaS ).    IaaS provides virtualized computing resources, PaaS offers a platform for application development and deployment, and SaaS delivers software applications over the internet.     Benefits such as cost efficiency, scalability, flexibility, acc...