DBMS SQL Table - Javatpoint
DBMS SQL Table - Javatpoint
⇧ SCROLL TO TOP
SQL Table
SQL Table is a collection of data which is organized in terms of rows and columns. In DBMS, the table is
known as relation and row as a tuple.
Table is a simple form of data storage. A table is also considered as a convenient representation of
relations.
In the above table, "EMPLOYEE" is the table name, "EMP_ID", "EMP_NAME", "CITY", "PHONE_NO" are the
column names. The combination of data of multiple columns forms a row, e.g., 1, "Kristen", "Washington"
and 7289201223 are the data of one row.
ADVERTISEMENT
ADVERTISEMENT
Operation on Table
1. Create table
2. Drop table
3. Delete table
4. Rename table
SQL create table is used to create a table in the database. To define the table, you should define the name
of the table and also define its columns and column's data type.
Syntax
Download now
Trade responsibly.
62% of retail CFD accounts lose money
If you create the table successfully, you can verify the table by looking at the message by the SQL server.
Else you can use DESC command as follows:
Now you have an EMPLOYEE table in the database, and you can use the stored information related to the
employees.
Drop table
A SQL drop table is used to delete a table definition and all the data from a table. When this command is
executed, all the information available in the table is lost forever, so you have to very careful while using this
command.
Syntax
Firstly, you need to verify the EMPLOYEE table using the following command:
Replay
This table shows that EMPLOYEE table is available in the database, so we can drop it as follows:
Now, we can check whether the table exists or not using the following command:
In SQL, DELETE statement is used to delete rows from a table. We can use WHERE condition to delete a
specific row from a table. If you want to delete all the records from the table, then you don't need to use the
WHERE clause.
Syntax
Example
If you don't specify the WHERE condition, it will remove all the rows from the table.
← Prev Next →
Feedback
Preparation
Trending Technologies
Machine DevOps
Learning Tutorial
Tutorial DevOps
Machine
Learning
B.Tech / MCA