本文目錄一覽:
- 1、怎樣從mysql資料庫中讀取數據表的欄位名字
- 2、mysql 編碼是 latin1 如何 獲取 裡面中文數據 ???
- 3、怎樣在mysql中獲取列名
- 4、mysql中如何查詢中文欄位
- 5、怎麼查詢mysql對應中文名稱
- 6、資料庫中怎麼樣使查詢結果的列名為對應中文
怎樣從mysql資料庫中讀取數據表的欄位名字
可以通過查詢系統表來獲取。
1、打開Navicat for Mysql,登錄到指定資料庫下。
2、新建查詢。
3、輸入以下語句:
select column_name from information_schema.COLUMNS where table_name=’表名’
結果:
其中id和name就是test表的欄位名字。
mysql 編碼是 latin1 如何 獲取 裡面中文數據 ???
直接修改資料庫中這個表裡面欄位的編碼,改成utf-8類型,就可以存儲和讀取中文了,alter table 表名 change 欄位名 欄位名 varchar() character set utf8 not null。
怎樣在mysql中獲取列名
use 資料庫名;
show tables; //顯示資料庫中的表
desc 具體某個表的名稱; //列出想要的表的列名信息
//或者:show columns form 具體某個表的名稱;
mysql中如何查詢中文欄位
直接用中文名稱即可查詢。
可按如下方法做測試:
1、創建表插入數據:
create table test
(序號 int,
名稱 varchar(10));
insert into test values (1,’張三’);
insert into test values (2,’李四’);
2、執行查詢:
select * from test where 序號=1
結果顯示:
也就是說中文欄位名在查詢中可以直接引用。
怎麼查詢mysql對應中文名稱
MySQL查詢中文和查詢外文沒有分別,都是一樣的,只要將字符集設置為支持中文的字符集(例如gb2312等)就可以查詢出正確的結果。
資料庫中怎麼樣使查詢結果的列名為對應中文
1、創建測試表,create table test_student(stu_id number, class_id number);
2、插入測試數據,
insert into test_student values(1,1001);
insert into test_student values(2,1001);
insert into test_student values(3,1002);
insert into test_student values(4,1003);
insert into test_student values(5,1003);
insert into test_student values(6,1003);
commit;
3、查詢數據表中內容,select * from test_student ;
4、將列名翻譯為中文名進行展示,select stu_id as “學生編碼”, class_id as “課程編碼” from test_student t;
原創文章,作者:小藍,如若轉載,請註明出處:https://www.506064.com/zh-tw/n/192838.html