mysqlcrud语句
MySQL的基本操作可以包括两个方面:MySQL常用语句如高频率使用的增删改查(CRUD)语句和MySQL高级功能,如存储过程,触发器,事务处理等。而这两个方面又可以细分如下:MySQL常用语句表(或...
2024.11.15供应商供货目录表
CREATE TABLE products
(
prod_id char(10) NOT NULL,
vend_id int NOT NULL ,
prod_name char(255) NOT NULL ,
prod_price decimal(8,2) NOT NULL ,
prod_desc text NULL ,
PRIMARY KEY(prod_id)
)
insert INTO products(prod_id, vend_id, prod_name, prod_price, prod_desc)
VALUES(‘ANV01‘, 1001, ‘.5 ton anvil‘, 5.99, ‘.5 ton anvil, black, complete with handy hook‘);
insert INTO products(prod_id, vend_id, prod_name, prod_price, prod_desc)
VALUES(‘ANV02‘, 1001, ‘1 ton anvil‘, 9.99, ‘1 ton anvil, black, complete with handy hook and carrying case‘);
insert INTO products(prod_id, vend_id, prod_name, prod_price, prod_desc)
VALUES(‘ANV03‘, 1001, ‘2 ton anvil‘, 14.99, ‘2 ton anvil, black, complete with handy hook and carrying case‘);
insert INTO products(prod_id, vend_id, prod_name, prod_price, prod_desc)
VALUES(‘OL1‘, 1002, ‘Oil can‘, 8.99, ‘Oil can, red‘);
insert INTO products(prod_id, vend_id, prod_name, prod_price, prod_desc)
VALUES(‘FU1‘, 1002, ‘Fuses‘, 3.42, ‘1 dozen, extra long‘);
insert INTO products(prod_id, vend_id, prod_name, prod_price, prod_desc)
VALUES(‘SLING‘, 1003, ‘Sling‘, 4.49, ‘Sling, one size fits all‘);
insert INTO products(prod_id, vend_id, prod_name, prod_price, prod_desc)
VALUES(‘TNT1‘, 1003, ‘TNT (1 stick)‘, 2.50, ‘TNT, red, single stick‘);
insert INTO products(prod_id, vend_id, prod_name, prod_price, prod_desc)
VALUES(‘TNT2‘, 1003, ‘TNT (5 sticks)‘, 10, ‘TNT, red, pack of 10 sticks‘);
insert INTO products(prod_id, vend_id, prod_name, prod_price, prod_desc)
VALUES(‘FB‘, 1003, ‘Bird seed‘, 10, ‘Large bag (suitable for road runners)‘);
insert INTO products(prod_id, vend_id, prod_name, prod_price, prod_desc)
VALUES(‘FC‘, 1003, ‘Carrots‘, 2.50, ‘Carrots (rabbit hunting season only)‘);
insert INTO products(prod_id, vend_id, prod_name, prod_price, prod_desc)
VALUES(‘SAFE‘, 1003, ‘Safe‘, 50, ‘Safe with combination lock‘);
insert INTO products(prod_id, vend_id, prod_name, prod_price, prod_desc)
VALUES(‘DTNTR‘, 1003, ‘Detonator‘, 13, ‘Detonator (plunger powered), fuses not included‘);
insert INTO products(prod_id, vend_id, prod_name, prod_price, prod_desc)
VALUES(‘JP1000‘, 1005, ‘JetPack 1000‘, 35, ‘JetPack 1000, intended for single use‘);
insert INTO products(prod_id, vend_id, prod_name, prod_price, prod_desc)
VALUES(‘JP2000‘, 1005, ‘JetPack 2000‘, 55, ‘JetPack 2000, multi-use‘);
客户表
CREATE TABLE customers
(
cust_id int NOT NULL AUTO_INCREMENT,
cust_name char(50) NOT NULL ,
cust_address char(50) NULL ,
cust_city char(50) NULL ,
cust_state char(5) NULL ,
cust_zip char(10) NULL ,
cust_country char(50) NULL ,
cust_contact char(50) NULL ,
cust_email char(255) NULL ,
PRIMARY KEY (cust_id)
)
insert INTO customers(cust_id, cust_name, cust_address, cust_city, cust_state, cust_zip, cust_country, cust_contact, cust_email)
VALUES(10001, ‘Coyote Inc.‘, ‘200 Maple Lane‘, ‘Detroit‘, ‘MI‘, ‘44444‘, ‘USA‘, ‘Y Lee‘, ‘ylee@coyote.com‘);
insert INTO customers(cust_id, cust_name, cust_address, cust_city, cust_state, cust_zip, cust_country, cust_contact)
VALUES(10002, ‘Mouse House‘, ‘333 Fromage Lane‘, ‘Columbus‘, ‘OH‘, ‘43333‘, ‘USA‘, ‘Jerry Mouse‘);
insert INTO customers(cust_id, cust_name, cust_address, cust_city, cust_state, cust_zip, cust_country, cust_contact, cust_email)
VALUES(10003, ‘Wascals‘, ‘1 Sunny Place‘, ‘Muncie‘, ‘IN‘, ‘42222‘, ‘USA‘, ‘Jim Jones‘, ‘rabbit@wascally.com‘);
insert INTO customers(cust_id, cust_name, cust_address, cust_city, cust_state, cust_zip, cust_country, cust_contact, cust_email)
VALUES(10004, ‘Yosemite Place‘, ‘829 Riverside Drive‘, ‘Phoenix‘, ‘AZ‘, ‘88888‘, ‘USA‘, ‘Y Sam‘, ‘sam@yosemite.com‘);
insert INTO customers(cust_id, cust_name, cust_address, cust_city, cust_state, cust_zip, cust_country, cust_contact)
VALUES(10005, ‘E Fudd‘, ‘4545 53rd Street‘, ‘Chicago‘, ‘IL‘, ‘54545‘, ‘USA‘, ‘E Fudd‘);
订单表
CREATE TABLE orders
(
order_num int NOT NULL AUTO_INCREMENT,
order_date datetime NOT NULL ,
cust_id int NOT NULL ,
PRIMARY KEY (order_num)
)
insert INTO orders(order_num, order_date, cust_id)
VALUES(20005, ‘2005-09-01‘, 10001);
insert INTO orders(order_num, order_date, cust_id)
VALUES(20006, ‘2005-09-12‘, 10003);
insert INTO orders(order_num, order_date, cust_id)
VALUES(20007, ‘2005-09-30‘, 10004);
insert INTO orders(order_num, order_date, cust_id)
VALUES(20008, ‘2005-10-03‘, 10005);
insert INTO orders(order_num, order_date, cust_id)
VALUES(20009, ‘2005-10-08‘, 10001);
另外,往期相关文章链接如下:
MySQL的基本操作可以包括两个方面:MySQL常用语句如高频率使用的增删改查(CRUD)语句和MySQL高级功能,如存储过程,触发器,事务处理等。而这两个方面又可以细分如下:MySQL常用语句表(或...
2024.11.15#*** client options 相关选项 ***##以下选项会被MySQL客户端应用读取。注意只有MySQL附带的客户端应用程序保证可以读取这段内容。如果你想你自己的MySQL应用程序获取这些...
2024.11.15今天学习的主要内容是刘金玉老师MySQL数据库零基础教程第22期。学习的内容是mysql数据分类汇总。一、数据分类汇总基础知识数据分类汇总主要利用关键词group by结合聚合函数来实现。Group ...
2024.11.13概览最近开始在学习mysql相关知识,自己根据学到的知识点,根据自己的理解整理分享出来,本篇文章会分析下一个sql语句在mysql中的执行流程,包括sql的查询在mysql内部会怎么流转,sql语句的...
2024.11.15MySQL和Oracle都是流行的关系数据库管理系统(RDBMS),在世界各地广泛使用;大多数数据库以类似的方式工作,但MySQL和Oracle的这里和那里总是存在一些差异的。本篇文章就给大家比较Or...
2024.11.15