Blogger Information
Blog 38
fans 1
comment 0
visits 28755
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
11月20日_数据库增删查改
fkkf467
Original
730 people have browsed it

1. 数据库增删查改(手写)

2. 创建数据表,每张表有10个字段


3. 以 user_list 表为例,进行练习

1. 插入数据

  1. INSERT INTO user_list ( `user_name`, `user_password`, `user_img`, `user_sex`, `user_age`, `user_email`, `user_phone`, `like_movie`, `user_sign` )
  2. VALUES
  3. ( '小红', 'abc567', 'head5.jpg', '女', 19, 'xh@163.com', '13174598612', '最普通的恋爱', '美美美' )


2. 删除数据
注意:一定不要忘了加条件,否则会删除所有数据

  1. DELETE FROM `user_list` WHERE user_id = '5'



3. 修改数据
注意:一定不要忘了加条件,否则会修改所有数据

  1. UPDATE `user_list`
  2. SET `like_movie` = '最普通的恋爱',
  3. `user_sign` = '坚持就是胜利'
  4. WHERE
  5. user_id = 2



4. 查找数据
查找全部

  1. SELECT * FROM `user_list`

  1. SELECT `user_name`,`user_age`,`user_sex` FROM `user_list`


按条件查找

  1. SELECT * FROM `user_list` WHERE user_id = 3

  1. SELECT * FROM `user_list` WHERE user_id >= 2 AND user_id < 4

  1. SELECT * FROM `user_list` WHERE user_id >=2 LIMIT 1,2

4. 总结

学会了数据库的增删查改。

Correcting teacher:查无此人查无此人

Correction status:qualified

Teacher's comments:完成的不错,继续加油
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments