天天看點

Mysql基礎第七天,檢索資料

1.建立樣例表

Mysql基礎第七天,檢索資料

打開mysql指令行執行

use test;
  courese c:\\create.sql;  // 将表結構導入
  course c:\\info.sql; // 将資料導入      

2.sqlect語句

Mysql基礎第七天,檢索資料
select prod_name from producs; //查詢單個列
select prod_id,prod_name from products;  // 查詢多個列
select * from products;// 查詢所有列
select distinct prod_name from products;//查詢不同的行
// 限制結果
select * from products limit 5; // 查詢不同的行
select * from products limit 4,5; // 從第四條開始往後顯示五條
select products.prod_id,products.prod_name,products,prod_price from products;    // 使用完全限定表名