SQL is one of the most important tool a Data Scientist or a Data analyst should know of. SQL is a query language which is used to manipulate and retrieve information from a Database.
SQL is used with R-DBMS (Relationship Database Management System) for retrieving and querying purpose.
In this blog, we will look into various basic SQL queries , where and when those queries are used.
There are five types of SQL commands:
The DDL commands are used to define the structure of the database. It is used for creating and modifying the database objects such as table, indexes etc… The basic DDL Commands are:
CREATE TABLE <table_name> (
<column_name1> datatype,
<column_name2> datatype,
<column_name3> datatype,
….
);
DROP TABLE <table_name>;
TRUNCATE TABLE <table_name>;
ALTER TABLE <table_name>
ADD <column_name> datatype;
ALTER TABLE <table_name>
DROP COLUMN <column_name>;
ALTER TABLE <table_name>
MODIFY COLUMN <column_name> datatype;
ALTER TABLE <table_name>
RENAME TO <new_table_name>;
DQL command are query commands which are used to retrieve data from the database.
Most used DQL command is SELECT command
Various condition can be specified with the select command. We will look into that in another blog.
SELECT * FROM<table_name>;
SELECT <column_name1>, <column_name2>, …
FROM <table_name>;
_‘*’ operator _is used for selecting all the columns from a table.
#database #rdbms #sql #mysql