Home » SQL

How to change a table name in SQL ?

Published on 12-Dec-2021 20:48:01
This is the command to change a table name in SQL: ALTER TABLE table_name RENAME TO new_table_name; We will start off by giving the keywords ALTER TABLE, then we will follow it up by giving the original name of the table, after that, we will give in the keywords RENAME TO and finally, we will give the new table name. For example, if we want to change the “employee” table to “employee_information”, this will be the command: AL... Read More

How to delete a table in SQL ?

Published on 12-Dec-2021 20:41:30
There are two ways to delete a table from sql: DROP and TRUNCATE. The DROP TABLE command is used to completely delete the table from the database. This is the command: DROP TABLE table_name; The above command will completely delete all the data present in the table along with the table itself. But if we want to delete only the data present in the table but not the table itself, then we will use the truncate command: DROP TABLE table_n... Read More

How to create a table in SQL ?

Published on 12-Dec-2021 19:36:18
The command to create a table in sql is extremely simple: CREATE TABLE table_name ( column1 datatype, column2 datatype, column3 datatype, .... ); We will start off by giving the keywords, CREATE TABLE, then we will give the name of the table. After that in braces, we will list out all the columns along with their datatypes. For example, if we want to create a simple employee table: CREATE TABLE employee ( name varchar(25... Read More

What is SQL ?

Published on 12-Dec-2021 19:28:20
SQL stands for Structured Query Language. It is the primary language to interact with databases. With the help of SQL, we can extract data from a database, modify this data and also update it whenever there is a requirement. This query language is evergreen and is widely used across industries. For example, if a company has records of all the details of their employees in the database. With the help of SQL, all of this data can be queried to find... Read More

How to Create a Table in SQL – Postgres and MySQL Example Query

Published on 27-Oct-2021 16:11:38
Knowing how to create tables in SQL is an important and fundamental concept. In this tutorial, I will walk you through the SQL syntax for the CREATE TABLE statement using code examples for both PostgreSQL and MySQL. Basic CREATE TABLE Syntax Here is the basic syntax for the CREATE TABLE statement: CREATE TABLE table_name( column1 data_type column_constraint, column2 data_type column_constraint, column3 data_type colu... Read More