MySQL資料型別 r3筆記第87天

2021-09-28 13:20:52 字數 2887 閱讀 5646

今天在本地裝了乙個mysql的學習環境,簡單的熟悉了一下。準備開始好好學習mysql了。-->數值型別

型別大小範圍(有符號)範圍(無符號)用途

tinyint

1 位元組

(-128,127)

(0,255)

小整數值

smallint

2 位元組

(-32 768,32 767)

(0,65 535)

大整數值

mediumint

3 位元組

(-8 388 608,8 388 607)

(0,16 777 215)

大整數值

int或integer

4 位元組

(-2 147 483 648,2 147 483 647)

(0,4 294 967 295)

大整數值

bigint

8 位元組

(-9 233 372 036 854 775 808,9 223 372 036 854 775 807)

(0,18 446 744 073 709 551 615)

極大整數值

float

4 位元組

(-3.402 823 466 e+38,1.175 494 351 e-38),0,(1.175 494 351 e-38,3.402 823 466 351 e+38)

0,(1.175 494 351 e-38,3.402 823 466 e+38)

單精度浮點數值

double

8 位元組

(1.797 693 134 862 315 7 e+308,2.225 073 858 507 201 4 e-308),0,(2.225 073 858 507 201 4 e-308,1.797 693 134 862 315 7 e+308)

0,(2.225 073 858 507 201 4 e-308,1.797 693 134 862 315 7 e+308)

雙精度浮點數值

decimal

對decimal(m,d) ,如果m>d,為m+2否則為d+2

依賴於m和d的值

依賴於m和d的值

小數值

-->字元型別

型別大小

用途char

0-255位元組

定長字串

varchar

0-255位元組

變長字串

tinyblob

0-255位元組

不超過 255 個字元的二進位制字串

tinytext

0-255位元組

短文本字串

blob

0-65 535位元組

二進位制形式的長文字資料

text

0-65 535位元組

長文字資料

mediumblob

0-16 777 215位元組

二進位制形式的中等長度文字資料

mediumtext

0-16 777 215位元組

中等長度文字資料

logngblob

0-4 294 967 295位元組

二進位制形式的極大文字資料

longtext

0-4 294 967 295位元組

極大文字資料

-->日期型別

型別大小

(位元組)

範圍格式

用途date

31000-01-01/9999-12-31

yyyy-mm-dd

日期值time

3'-838:59:59'/'838:59:59'

hh:mm:ss

時間值或持續時間

year

11901/2155

yyyy

年份值datetime

81000-01-01 00:00:00/9999-12-31 23:59:59

yyyy-mm-dd hh:mm:ss

混合日期和時間值

timestamp

81970-01-01 00:00:00/2037 年某時

yyyymmdd hhmmss

混合日期和時間值,時間戳

-->數值型別ora-01438: value larger than specified precision allowed for this column

mysql> create table test(id tinyint);128);1 warning (0.02 sec)127 |-->字元型別

mysql中varchar(6)代表可以存放6個漢字,6個字母,或6個數字。-->日期型別

datatype

time zone

fractional seconds

date

nono

timestamp

noyes

timestamp with time zone

explicit

yestimestamp with local time zone

relative

yescurrent_datefrom dual;--oracle中不能並行執行兩個查詢current_date;select current_date;--mysql裡面就可以很輕巧的實現

shell基礎學習總結 一 r3筆記第63天

關於shell也多多少少的寫了不少文章了。在工作中shell的使用也是相當的普遍了,尤其是基礎的學習。今天就簡單的總結一下,希望對大家有所幫助。檢視區域性 全域性環境變數91611 0 nov22 00 00 05 ora smon test01 cat proc 9161 environ tr 0...

和Null有關的函式 r3筆記第48天

關於null相關的函式在日常的工作中還有比較實用的,可能會碰到各種和null校驗相關的情況,大體有以下幾種。case when sql select case when 1 1 then 2 end from dual 如果1 1滿足,就返回2,否則返回null casewhen 1 1 then1...

關於索引和空值的討論 r3筆記第80天

在日常的工作中,空值總是有特殊的身份,對於它的處理有時候也是比較糾結。sql create table index test id number not null,name varchar2 30 exec dbms stats.gather table stats user,index test ...