LabVIEW(数据库连接)
扫描二维码
随时随地手机看文章
Driver={Microsoft Access Driver (*.mdb)};
Dbq=路径;
Uid=Admin;
Pwd=密码;
插入:
INSERT INTO xs(学号,姓名,专业名,性别,出生日期,身高,党员否) VALUES ('082212','李晓姝','机电一体化','女','1990-9-28',168,0)
也可以:
INSERT INTO xs VALUES ('082212','李晓姝','机电一体化','女','1990-9-28',168,0,NULL)
删除:
DELETE FROM xs WHERE 专业名='机电一体化'
删除所有行: DELETE FROM xs
修改记录:
xs表中所有学生成绩加10分:UPDATE xs_kc SET 成绩=成绩+10
姓名为李晓姝的同学专业改为“通信工程”,备注改为“转专业学习”,学号改为082141
UPDATE xs
SET 专业名='通信工程',
备注='转专业学习',
学号='082141'
WHERE 姓名='李晓姝'
查询:
SELECT * FROM xs WHERE 专业名='通信工程'
SELECT * FORM xs WHERE 身高>=170
SELECT * FORM xs WHERE 专业名='通信工程' OR 专业名='计算机网络'
SELECT * FORM xsWHERE专业名='计算机网络' AND 性别='男'
SELECT * FORM xsWHERE 出生日期 BETWEEN '1990-1-1' AND '1990-12-31' 等价于 SELECT * FORM xsWHERE 出生日期>='1990-1-1' AND 出生日期<='1990-12-31'
SELECT * FORM xsWHERE IN('计算机网络','计算机软件','通信工程') 等价于 SELECT * FORM xsWHERE 专业名='计算机网络' OR 专业名='计算机软件' OR 专业名='通信工程'
SELECT * FORM xsWHERE 姓名 LIKE '王%'
DESC :按递减输出
ASC:按递增输出
select * from student order by age desc , id desc;用“,”号隔开多个排序条件,这样,先按age 再按id,就是说,先按age从大到小排序,如果有相同年龄的,那么相同年龄的学生再按他们的id从大到小排序。
select sno, avg(DISTINCT grade) as 平均成绩from SCgroup by snowhere avg(DISTINCT grade)>70order by avg(grade) desc