SQL CREATE TABLE

It is used to create a new table in a database.

Syntax:

Understanding SQL datatypes:

Below is a table that lists common SQL data types and their descriptions:

Data TypeDescription
CHAR(n)Fixed-length string with a maximum length of n characters.
VARCHAR(n)Variable-length string with a maximum length of n characters.
TEXTLarge variable-length string.
INTInteger value.
BIGINTLarge integer value.
SMALLINTSmall integer value.
TINYINTTiny integer value.
FLOATFloating-point number.
DOUBLEDouble-precision floating-point number.
DECIMALExact decimal value.
NUMERICExact numeric value.
DATEDate value in the format YYYY-MM-DD.
TIMETime value in the format HH:MM:SS.
DATETIMEDate and time value in the format YYYY-MM-DD HH:MM:SS.
TIMESTAMPTimestamp value.

Note: The exact list of data types may vary depending on the database management system you are using. The data types listed above are commonly supported by most SQL implementations.

example of table :

above query will create car table with model, color and manufacturer as column

INT, VARCHAR are the datatype of those column representing integer and character respectively .

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top