新网创想网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
这篇文章给大家分享的是有关如何使用sql语句的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。
创新互联公司是一家专注网站建设、网络营销策划、小程序开发、电子商务建设、网络推广、移动互联开发、研究、服务为一体的技术型公司。公司成立十年以来,已经为近千家围栏护栏各业的企业公司提供互联网服务。现在,服务的近千家客户与我们一路同行,见证我们的成长;未来,我们一起分享成功的喜悦。
update
1、set一个字段在表t_test中设置第二条记录(bs为2)的password为'***'。update t_test t set t.password = '***' where t.bs = 2;
http://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';
参考:http://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='13455557777@iz280uotbvjz';
感谢各位的阅读!关于“如何使用sql语句”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!