What is Table in ,MySql
SQL CREATE TABLE statement is used to create table in a database. If you want to create a table, you should name the table and define its column and each column's data type.
Tables are used to store data in the database. Tables are uniquely named within a database and schema. Each table contains one or more columns. And each column has an associated data type that defines the kind of data it can store e.g., numbers, strings, or temporal data.
create table syntax:
The data type of the columns may vary from one database to another. For example, NUMBER is supported in Oracle database for integer value whereas INT is supported in MySQL.
Let us take an example to create a STUDENTS table with ID as primary key and NOT NULL are the constraint showing that these fields cannot be NULL while creating records in the table.
create table output:
create
Now you have the STUDENTS table available in your database and you can use to store required information related to students
The column parameters specify the names of the columns of the table. The datatype parameter specifies the type of data the column can hold (e.g. varchar, integer, date, etc.).
Note:
In addition to the standard reserved keywords, the following keywords cannot be used as column identifiers because they are reserved for ANSI-standard context functions CURRENT_DATE CURRENT_ROLE, CURRENT_TIME, CURRENT_TIMESTAMP, CURRENT_USER
DEFAULT and AUTOINCREMENT are mutually exclusive; only one can be specified for a column.
No comments:
Post a Comment