Syntax - Basic Create Table:
CREATE TABLE TableName( TableName DataType Constraint );
What does it do? The Access SQL CREATE TABLE statment creates a new table with specified columns and constraints in the database. When adding more than one column and a comma after the previous columns' constraint. Note: don't add a comma after the last column that will break the SQL Statement.
Common Data type list:
Example:
CREATE TABLE Customers( Id AUTOINCREMENT PRIMARY KEY, FirstName VARCHAR(35) NOT NULL, LastName VARCHAR(35) NOT NULL, IsActive YESNO, RegistrationDate DATETIME, Email VARCHAR(100) );
Results: The table in the designer will look like this.
Blue - Is used to identify reserved keywords/characters that are used by the SQL engine, i.e. SELECT, FROM, or WHERE.
Purple - Is used to identify portions of the SQL statement that are defined by the user, i.e. Column Names, Table Names, Inputed Values.