MySQL创建和操纵表
作者:互联网
创建表
CREATE TABLE products_a (prod_id CHAR(10) NOT NULL, vend_id CHAR(10) NOT NULL, prod_name char(254) NOT NULL, prod_price DECIMAL(8,2) NOT NULL, prod_desc VARCHAR(1000) NULL);
使用null值
CREATE TABLE orders_o (order_num INTEGER NOT NULL, order_date datetime NOT NULL, cust_id CHAR(10));
指定默认值
CREATE TABLE orderitems_o (order_num INTEGER NOT NULL, order_item INTEGER NOT NULL, prod_id CHAR(10) NOT NULL, quantity INTEGER NOT NULL DEFAULT 1, item_price DECIMAL(8,2) NOT NULL);
SELECT * FROM orderitems_o;
更新表
ALTER TABLE vendors ADD vend_phone CHAR(20);
删除表
DROP TABLE custcopy;
标签:CHAR,prod,10,创建,操纵,MySQL,TABLE,NULL,id 来源: https://blog.csdn.net/qq_37335220/article/details/112404341