01:创建一个数据库:create database db_test;
02:使用某个数据库:use db_test;
03:创建表:
create table t_test( id int primary key,name varchar(11),age int );
04:往数据表中增加记录:
insert t_test(id) values(1); insert t_test(id,name) values(2,'test2'); insert t_test(id,name,age) values(3,'test3',30);
05:更新数据表中的记录:
update t_test set name='test1',age=10 where id=1; update t_test set age=20 where id=2;
06:删除数据表中记录:
delete t_test where id=3;
select id,age from t_test;
注:查询的时候,一般不写select * from,原因是,select * from语句,如果数据表中新增了字段,程序将会出错。
最基本的操作就写到这里,实际开发中这些最基本的也是最实用的东西。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。