特别注意 MacOS 上启动 MySQL 服务方式的问题:
- 运行
brew service start mysql
可以后台启动 mysql - 运行
mysql.server start
前台启动 mysqlmysql.server stop
登陆 MySQL:
mysql -u root -p
# password in my laptop: **Bin123456!**
create table material_bill(
product_id INT NOT NULL AUTO_INCREMENT,
product_title VARCHAR(100) NOT NULL,
product_spec VARCHAR(40),
quantity INT DEFAULT 1,
unit_price INT DEFAULT 0 NOT NULL,
total_price INT DEFAULT 0,
remarks VARCHAR(100),
PRIMARY KEY ( product_id )
);
drop table laoliprices_productprices;
In MySQL, the meaning of LIMIT n1, n2 is :
n1 : starting index
n2 : number of record/data you want to show
For example :
ID
-------------------------
1 ------------ > index 0
2
3
4
5
6
7
8
9
10 ------------ > index 9
Now if you write query like
SELECT * from tbl_name LIMIT 0,5
Output :
1
2
3
4
5