Added basic information (#25293)
* Added additional basic information * Removed extra line break
This commit is contained in:
committed by
Manish Giri
parent
e3744dff30
commit
d91bad7d2f
@ -9,11 +9,19 @@ A table is a group of data stored in a database.
|
|||||||
|
|
||||||
To create a table in a database you use the `CREATE TABLE` statement. You give a name to the table and a list of columns with its datatypes.
|
To create a table in a database you use the `CREATE TABLE` statement. You give a name to the table and a list of columns with its datatypes.
|
||||||
|
|
||||||
|
##### SYNTAX #####
|
||||||
|
```sql
|
||||||
|
CREATE TABLE table_name(Attribute1 Datatype,
|
||||||
|
Attribute2 Datatype,
|
||||||
|
........);
|
||||||
```
|
```
|
||||||
CREATE TABLE TABLENAME(Attribute1 Datatype, Attribute2 Datatype,........);
|
here:
|
||||||
```
|
* Attribute1, Attribute2... -> Column Name
|
||||||
|
* Datatype... -> type of value you want to column have. For eg. int(size), char(size), Varchar(size),etc.
|
||||||
|
|
||||||
|
|
||||||
Here’s an example creating a table named Person:
|
Here’s an example creating a table named Person:
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
CREATE TABLE Person(
|
CREATE TABLE Person(
|
||||||
Id int not null,
|
Id int not null,
|
||||||
@ -31,5 +39,5 @@ A column can be `not null` or `null` indicating whether it is mandatory or not.
|
|||||||
|
|
||||||
#### More Information:
|
#### More Information:
|
||||||
<!-- Please add any articles you think might be helpful to read before writing the article -->
|
<!-- Please add any articles you think might be helpful to read before writing the article -->
|
||||||
|
[SQL | CREATE](https://www.geeksforgeeks.org/sql-create/)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user