MySQL查詢語句

2022-02-20 00:49:28 字數 811 閱讀 2862

1.固定語法

select

*from

表名--

*代表查詢『結果』

1. 若後邊有查詢條件,則*代表所有可能結果;比如select name/*

from 表名 where age ='11';為查詢年齡為11的姓名/所有字段

2. 若後邊無條件,則*代表所有查詢內容(其實也是查詢結果)select * from 表名;

-- select from 為固定語法,表示從表中查詢

##select from 中間為查詢結果,不可為age = '11'這樣的條件

##有篩選條件,where不可望,where後邊跟篩選條件

2.擴充套件

1.select

*from 表名 where name =

'xiaoming

'and age ='11

';--where為固定連詞,後跟條件

--and/or為多條件篩選

其他變形形式:

select

*from 表名 where age ='11

';select

*from 表名 where name =

'xiaoming';

select

*from 表名 where name =

'xiaoming

'and/or age ='11

';##select name from 表名 where age ='11

';--查詢年齡為11的名字

##所有**在英文狀態下,保持空格一致

mysql 查詢語句

在pdo中有很多模式能用,在使用的時候在用 bindvalue 的時候 在select 中有in 的 語句無法實現,在傳入的時候 select from users where id in 1,2,3 當1,2,3 用 pdo param str 的時候,會出現這種情況 select from ue...

MySQL查詢語句

建立水果表 create table fruits f id char 10 not null,s id int notnull,f name char 255 not null,f price decimal 8,2 not null,primary key f id 插入資料 insert in...

MYSQL查詢語句

內連線 取的兩個表的 有能連線的字段 的交集,即欄位相同的。利用內連線可獲取兩表的公共部分的記錄。select st.sno,st.sname,st.s st.age,st.sdept,co.cname,sc.grade from student st,course co,score sc wher...