数据库的创建
语法
create database database_name
表的创建
语法
create table table_name(<列名1> <数据类型> <该列所需约束>,<列名2> <数据类型> <该列所需约束>,<列名3> <数据类型> <该列所需约束>,......<该表的约束1>, <该表的约束2>, ...)
示例
create table Product(product_id char(4) not null,product_name varchar(100) not null,product_type varchar(32) not null,sale_price integer ,purchase_price integer ,regist_date date ,primary key (product_id));
命名规范
- 数据库名称、表名和列名(、别名)等只可以使用以下 3 种字符。
- 半角英文字母
- 半角数字
- 下划线(_)
- 名称必须以半角英文字母作为开头。
- 名称不能重复。
