ÆäËûÊý¾Ý¿âÄ£ÄâʵÏÖmysqlµÄlimitÓï·¨
¼ÙÈçÎÒÓиöuser±í,ÎÒÏë²éѯ·ûºÏijЩÌõ¼þµÄµÚ50¸öÓû§¿ªÊ¼µÄ10¸öÓû§,ÇÒ²»ÄÜʹÓÃidºÅbetween andÄÇÑù²éѯ,Ó¦¸ÃÔõôдSQLÓï¾ä?
¡¡¡¡ÔÚmysqlÊý¾Ý¿âÖÐÓÐlimit,offsetÓï¾ä¿ÉÒÔ·½±ãµÄʵÏÖ,ÄÇôÔÚSQL serverÖÐÄØ?SQL ServerÊÇ·ñÖ§³ÖlimitºÍoffsetÓï¾äÄØ?
select top 10 * from
(select top 60 * from [user] order by userid) aa
order by userid desc
¡¡¡¡oracle,Èç¹ûÏë´Ó±íÖÐÈ¡³ö°´ÕÕij×Ö¶ÎÅÅÐòǰMµ½NÌõ¼Ç¼
¡¡¡¡ÏÂÃæµÄORACLEÓï¾äÊÇ×îºÃµÄ:
SQL> select ID from
(
select ID , rownum as con from
(
select ID from TestSort order by ID
)
where rownum <= 3 /*NÖµ*/
)
where con >= 2; /*M Öµ*/
ID
----------
2
3
Ïà¹ØÎĵµ£º
1¡¢MySQL³£ÓÃÃüÁî
create database name; ´´½¨Êý¾Ý¿â
use databasename; Ñ¡ÔñÊý¾Ý¿â
drop database name Ö±½Óɾ³ýÊý¾Ý¿â£¬²»ÌáÐÑ
show tables; ÏÔʾ±í
describe tablename; ±íµÄÏêϸÃèÊö
select ÖмÓÉÏdistinctÈ¥³ýÖØ¸´×Ö¶Î
mysqladmin drop databasename ɾ³ýÊý¾Ý¿âǰ£¬ÓÐÌáʾ¡£
ÏÔʾµ±Ç°mysql°æ±¾ºÍµ±Ç°È ......
MySQL client programs:
mysql
The command-line tool for interactively entering SQL statements or executing them from a file in batch mode. See Section 4.5.1, “mysql — The MySQL Command-Line Tool”.
mysqladmin
A client that performs administrative operations, such as crea ......
£¨1£©¸ñʽ£ºgrant select on Êý¾Ý¿â.* to Óû§Ãû@µÇ¼Ö÷»ú identified by "ÃÜÂë"
£¨2£©Àý1¡¢Ôö¼ÓÒ»¸öÓû§user_1ÃÜÂëΪ123£¬ÈÃËû¿ÉÒÔÔÚÈκÎÖ÷»úÉϵǼ£¬²¢¶ÔËùÓÐÊý¾Ý¿âÓвéѯ¡¢²åÈë¡¢Ð޸ġ¢É¾³ýµÄȨÏÞ¡£Ê×ÏÈÓÃÒÔrootÓû§Á¬ÈëMySQL£¬È»ºó¼üÈëÒÔÏÂÃüÁ
mysql> grant select,insert,update,delete on *.* to use ......
Ò»¡¢Êý×ÖÀàÐÍ
ËùνµÄ“Êý×ÖÀà”£¬¾ÍÊÇÖ¸ DECIMAL ºÍ
NUMERIC£¬ËüÃÇÊÇͬһÖÖÀàÐÍ¡£ËüÑϸñµÄ˵²»ÊÇÒ»ÖÖÊý×ÖÀàÐÍ£¬ÒòΪËûÃÇʵ¼ÊÉÏÊǽ«Êý×ÖÒÔ×Ö·û´®ÐÎʽ±£´æµÄ£»ËûµÄÖµµÄÿһ루°üÀ¨Ð¡Êýµã£©Õ¼Ò»¸ö×ֽڵĴ洢¿Õ¼ä£¬Òò´ËÕâÖÖÀàÐͺķѿռä±È½Ï´ó¡£µ«ÊÇËüµÄÒ»¸öÍ»³öµÄÓŵãÊÇСÊýµÄλÊý¹Ì¶¨£¬ÔÚÔËËãÖв»»á“ʧ ......