MySQL Tutorial
Table is a collection of data, organized in terms of rows and columns.
Table is the simple form of data storage or store a set of records.
A table creation command requires Name of the table, Names of fields and Definitions for each field
The MySQL CREATE Table statement is used to create a new MySQL table.
CREATE TABLE table_name
(
column1 data_type(size),
column2 data_type(size),
column3 data_type(size),
....
);
table_name: Name of the table you want to create under a database.
column : Name of the columns in side the table.
data_type: Type of data we want to store in the particular column
size: Size of the data we can store in a particular column
Here, we will create a table named "Students" in the database "first_db".
CREATE TABLE Students
(
ROLL_NO int(3),
NAME varchar(20),
SUBJECT varchar(20),
);
Students : Name of the table
ROLL_NO : Name of the column one in side the table and is of type int and will hold an integer.
NAME, SUBJECT : Name of columns are type varchar and will hold characters, and the maximum length for these fields is 20 characters.
The empty "Students" table will now look like this:
You can verify if your table has been created successfully using the DESCRIBE command as follows −
DESCRIBE Students;
Now, you have Students table available in your database which you can use to store the required information related to Students.