现在的位置: 首页 > 数据库 > 正文

sql语句学习

2019年03月09日 数据库 ⁄ 共 2850字 ⁄ 字号 评论关闭

秒速赛车公式 www.l19l7.cn update

1、set一个字段
在表t_test中设置第二条记录(bs为2)的password为'***'。
update t_test t
?? set t.password = '***'
where t.bs = 2;

//lavasoft.blog.51cto.com/62575/27692

?

login

mysql -h 11.11.11.1 -u root -p

mysql -u root -p

view table field?

desc tablename

mysql> select host,user from mysql.user;
+-----------+-------------+
| host      | user        |
+-----------+-------------+
| %         | fishadmin   |
| %         | jiraadmin   |
| %         | root        |
| %         | udanceadmin |
| localhost | fishadmin   |
| localhost | jiraadmin   |
| localhost | jirauser    |
| localhost | root        |
+-----------+-------------+
8 rows in set (0.00 sec)

%意思任意主机都可以连接

android Sqlite

--update message set readstatus = 1 where sender = 13455556669 and receiver = 13455556667 and readstatus = 0;

--select * from message where readstatus <> 0;//readstatus不等于0的数据

--select * from message where sender='13455556661' and receiver='13455556663' and process=103 order by _id desc;
--select * from message limit 3;--只查询前三条数据
--select * from message limit 2,1;--指定偏移量和查询数据条数
select count(1) from message;--查询消息表中的数据条数


2.数据库查询语句
select * from message order by _id asc;按_id的升序
select * from message order by _id desc;按_id的降序
2.1
select sender,receiver,content from message group by sender order by _id desc;
当order by和group by一起使用的时候,要先用group by,再用order by


4.关于删除
从message表中删除_id=2的一条记录的SQL语句:
delete from message where _id = '2';
参考://blog.sina.com.cn/s/blog_69092aea0101879o.html
--select * from message order by _id desc;
--select * from message where sender = 'hello1' and receiver = 'hello2' or sender = 'hello2' and receiver = 'hello1';
--select * from message where sender = 'hello2' and receiver = 'hello1';
--CREATE TABLE IF NOT EXISTS temporder(_id INTEGER PRIMARY KEY AUTOINCREMENT, ordernumber text, ordertime text, appointtime text, appointstatus text, stationname text, serviceitem text,saname text, telephone text, rating text, commentcount text, isAuth INTEGER,
carbrand text, carkind text, carnum text, carage text, carmiles text, worktime text, price text, shoplongi text, shoplati text);
--CREATE TABLE IF NOT EXISTS ordera (_id INTEGER PRIMARY KEY AUTOINCREMENT, ok text);
--select _id, appointstatus, appointtime, ordernumber, stationname, serviceitem, saname, telephone from repairorder where telephone=13566667777;

--delete from message where _id = '2';

--CREATE TABLE IF NOT EXISTS carinfo (_id INTEGER PRIMARY KEY AUTOINCREMENT, carLogo INTEGER, carNum TEXT, carBrand TEXT, carLevel TEXT, carYear TEXT, phone TEXT);
--delete from message;
--select content from message where _id < 50 order by _id asc;
--select * from message group by sender;-- where readstatus = 0
--select * from message where receiver = 13455557777;
--update message set readstatus = 0 ;--where sender = 13455556667 and receiver = 13455557777;
--select * from message where readstatus=1 group by sender;
--delete from friendrequest;
--update friendrequest set agree=10 where reqfrom='13455556664' and reqto='13455556665';
--update friendrequest set agree = 13,icon='abc',added=32 where reqfrom= '13455556664' and reqto= '13455556665';
--select content from message;
--select _id from carinfo;
--update carinfo set carid = 110 where _id=12;
--delete from message;
--create table friends (username TEXT);
delete from friends where username = '13455556668' and jid='[email protected]';??

抱歉!评论已关闭.

  • 一以贯之推进党的建设新的伟大工程 2019-03-19
  • 回复@真理论者:你天天在强坛攻击爱因斯坦是不是劳动?创造价值么?负价值也! 2019-03-19
  • 北京天安门广场更换花卉 2019-03-18
  • 党的自我革命是伟大社会革命的强大动力(深入学习贯彻习近平新时代中国特色社会主义思想) 2019-03-18
  • 人民日报人民时评:让安全生产理念成为基本共识 2019-03-18
  • “人民体育 健康中国”马拉松系列赛北京站 2019-03-17
  • 识破“假大学”并没那么难 2019-03-17
  • 佛山:用公积金买装配式住房 贷款额度或可上浮20% ——凤凰网房产北京 2019-03-17
  • 奥运冠军寄语Running Together国际迷你马拉松—在线播放—《奥运冠军寄语Running Together国际迷你马拉松》—体育—优酷网,视频高清在线观看 2019-03-17
  • 【理上网来喜迎十九大】西班牙学者:大国外交令中国成为建立世界新秩序的中流砥柱 2019-03-16
  • 马上背!十九大报告中的四个“新” 2019-03-16
  • 呼市赛罕区南门外小学开展庆父亲节亲子趣味足球赛 2019-03-16
  • 2017大皖客户端徽派栏目全面回顾宣传片 2019-03-15
  • 回复@海之宁:你想自主劳动?全民所有的生产资料凭啥让你自主? 2019-03-15
  • 重庆市南岸区:探索建立“微益坊” 2019-03-15
  • 825| 676| 299| 327| 634| 909| 929| 174| 497| 499|