当前位置:Gxlcms > 数据库问题 > 数据库常用方法

数据库常用方法

时间:2021-07-01 10:21:17 帮助过:2人阅读

创建数据库
1、新建连接(连接名,数据库路径和文件名)

ddl (结构定义 CREATE ALTER DROP)
dml(数据操作 INSERT DELETE UPDATE SELECT)

创建表
create table
修改表
alter table

—删除表
DROP table t_cjb

--插入数据
insert into 表名(名字 字段)values(值,值)
--修改数据
--update 表名 set 字段名=值。。。。 where 条件
update t_student set telnum = ‘2‘
where name=‘12345678901‘

--删除数据
--delete from 表名 where 条件
delete from t_student where name = ‘12345678901‘

--查找
--select 字段列表 from 表名 where 条件 order by 排序 *表示所有字段
select *from t_student

--模糊查询 like ‘a%‘ 表示查找包含a的所有数据
select * from t_student where name like ‘a%

—count(*)表示有多少行
select count(*) from t_student where age<9

--sum 求和 avg求平均值

数据库常用方法

标签:

人气教程排行