MySql常用查詢語句

根據字段進行查詢
select nickname from os_user where nickname = “biubiubiu”

查詢os_user_account表中金額由大到小排名前三的用戶的所有信息
select * from os_user_account order by balance desc limit 3

關聯查詢 在os_user表中與os_user_account表中查詢nickname=“biubiubiu”的金額“blance”爲多少?
SELECT os_user_account.balance from os_user_account INNER JOIN os_user ON os_user.Id=os_user_account.os_user_id WHERE os_user.nickname=‘biubiubiu’

關聯查詢
SELECT * FROM os_user_account where os_user_id in (SELECT id from os_user where nickname=‘那個傷’ or nickname=‘天亮’ )

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章