Essential SQL Command Types You Should Know
SQL Command Types
DQL (Data Query Language) | DDL (Data Definition Language) | DML (Data Manipulation Language) | DCL (Data Control Language) | TCL (Transaction Control language) |
SELECT | CREATE | INSERT | GRANT | COMMIT |
DROP | DELETE | REVOKE | ROLLBACK | |
ALTER | UPDATE | SAVEPOINT |
Learning databases hands-on using MySQL.
Note: SQL is a Non-Case Sensitive language means write query in any formats.
CREATE DATABASE database_name;
Refresh
USE Database database_name;
CREATE table table_name;
or
CREATE table table_name( Column_name1 Datatype, Column_name2 Datatype .....);
describe table_name;
Here we are entering values in table
Fetching and Retrieving Data
The SELECT Command which is 80% use in Database works
Select * from table_name;
or
Select * from Database_name.table_name;
if you want to get selective data from huge database
Select * from colum_name1, colum_name4, colum_name6;
Drop table_name;
Quick Recap
What are Aliases in SQL?
Aliases in SQL are used to give a table or a column a temporary name. This makes your queries easier to read and write. You can use aliases to shorten long table names or to make column names more descriptive.
For example:
SELECT column_name AS alias_name
FROM table_name;
Or for tables:
SELECT t.column_name
FROM table_name AS t;
Using aliases helps you write cleaner and more understandable SQL queries.
What are datatypes in SQL?
As per Programmer perspective : Datatypes are used to convert real-world data into binary format.
Datatypes in SQL are like labels that tell the database what kind of data you're storing in each column.
Here's a quick look at some common datatypes:
char
for fixed text lengthVARCHAR
for textINT
for whole numbersFLOAT
for decimal numbersDATE
for datesBoolean
for true/false
Choosing the right datatype is important to keep your database running smoothly!
That's a wrap! Thanks for reading. I hope you found it useful. Please leave a comment, like it, and share it with your friends. Happy learning!
Blog Recap
This article provides an overview of SQL command types including DQL, DDL, DML, DCL, and TCL, and explains key SQL commands like SELECT, CREATE, INSERT, GRANT, COMMIT, DROP, DELETE, REVOKE, ROLLBACK, ALTER, UPDATE, and SAVEPOINT.
It covers the basics of creating databases and tables, fetching and retrieving data, using aliases for readability, and understanding datatypes in SQL. The guide emphasizes hands-on learning with MySQL and offers practical examples to help you get started with SQL queries.
Resources
if you prefer Video format to learn these You can checkout this Youtube Video
About Me
Hey folks! I’m Aman, I am currently pursing 2nd year of BCA Information-Technology and am learning frontend Development with the help of Communities.
Am doing LearnInPublic & BuildInPublic so I’ll be sharing my learning in my Socials and I’ll make contents also by documenting my learnings.
Subscribe to my newsletter
Read articles from Aman Singh directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Aman Singh
Aman Singh
Hey folks! I’m Aman. I'm currently in my second year of BCA in Information Technology and learning frontend development with the help of various communities. I'm doing LearnInPublic and BuildInPublic, so I’ll be sharing my learning on my social media. I'll also create content by documenting my journey.