MySQL DatabaseLesson 60Free preview
MySQL Create Table
This lesson is part of PHP · All levels
Summary
A table is created using the CREATE DATABASE command with a list of columns and their data types. Each table generally has an id column as the PRIMARY KEY with AUTO_INCREMENT as the unique marker of the row. The NOT NULL, DEFAULT, and length clauses of VARCHAR help maintain the quality of data from the start.
Key points
- CREATE TABLE specifies the name of the table and the definition of the column.
- General data types: INT for numbers, VARCHAR for short text, TEXT for long text, DATETIME for time.
- The primary key guarantees that each line has a unique marker, the auto_increment fills it automatically.
- ALTER TABLE ADD is used to add columns to an existing table.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.