![]() I am going to consider the below tables to explain to you the various keys. There are mainly 7 types of Keys, that can be considered in a database. SQL Commands: Different Types Of Keys In Database Now that you know the data definition commands, let me take you through the various types of Keys and Constraints that you need to understand before learning how to manipulate the databases. This type of back up only backs up the parts of the database, which have changed since the last complete backup of the database. This statement is used to create a full backup of an existing database. Add a column DOB and change the data type to Date. Syntax ALTER TABLE TableNameĪLTER COLUMN ColumnName Datatype Example This statement is used to change the datatype of an existing column in a table. The ‘ALTER TABLE’ Statement with ALTER/MODIFY COLUMN If you wish to add a column, then you will use the ADD command, and if you wish to delete a column, then you will use the DROP COLUMN command. You can use the ALTER TABLE statement with ADD/DROP Column command according to your need. The ‘ALTER TABLE’ Statement with ADD/DROP COLUMN This statement is used to add, delete, modify columns in an existing table. This command is used to delete, modify or add constraints or columns in an existing table. So, once you use this command, your information will be lost, but not the table. This command is used to delete the information present in the table but does not delete the table. When you use this statement, complete information present in the table will be lost. This statement is used to drop an existing table. Syntax DROP DATABASE DatabaseName Example When you use this statement, complete information present in the database will be lost. This statement is used to drop an existing database. This statement is used to drop an existing table or a database. Refer the below sytax and example: The ‘CREATE TABLE AS’ Statement Syntax CREATE TABLE NewTableName AS You can also create a table using another table. This statement is used to create a table. Syntax CREATE DATABASE DatabaseName Example The ‘CREATE DATABASE’ StatementĪs the name suggests, this statement is used to create a database. This statement is used to create a table or a database. This section of the article will give you an insight into the commands through which you can define your database. SQL Commands: Data Definition Language Commands (DDL) So, any text mentioned between /* and */ will be ignored by the compiler. The Multi-line comments start with /* and end with */. So, any text mentioned after (–), till the end of a single line will be ignored by the compiler. ![]() The single line comment starts with two hyphens (–). either the Single-Line Comments or the Multi-Line Comments. There are two ways in which you can comment in SQL, i.e. So, let’s get started now! Comments in SQL In this article on SQL Commands, I am going to consider the below database as an example, to show you how to write commands.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |