peri hokiperihokiclarustologisticsrimashaop.compola taktis menang gates of olympus x1000 perihokipemain perihoki bongkar trik jepep starlight princess x1000perihoki beri panduan lengkap bermain mahjong ways 2 pgsofttips cara penghasil uang pgsoft mahjong ways 2 perihokimahjong wins 3 perihoki memberikan penggali terbesarfenomena gates of olympus buka peluang besar bagi duta76cara dapat pola emas rahasia di duta7 wild west goldtrik menang pgsoft mahjong ways 2 modal receh maxwin duta76duta76 main pgsoft mahjong ways 2 di sela istirahatscatter hitam mahjong wins 3 spin pasti jepe duta76perihoki spin mahjong ways 2 pgsoft scatter hitam maxwinsimbol mahjong wins 3 yang sering muncul di awal perihokitrik gampang menang mahjong winscuan mahjong wins 3 tanpa hentipola spin taruhan kecil mahjong winsstrategi kunci scatter hitam beruntungacor total mahjong wayskemenangan maksimal mahjong wayskemenangan pria pekanbaru mahjong waysmahjong wins3 fenomena baru sumatera baratmenangkan mahjong dengan lincahmenembus batas keberuntungan mahjong waysmenjajal keberuntungan di mahjong wayspola gratis mahjong ways1scatter hitam senjata rahasia mahjong winsteknik spinning menguntungkan untuk scatter hitamanalisis rtp tertinggi mahjong winsfenomena scatter hitam mahjong winsibu rumah tangga dan keberuntungan mahjongkeseruan main mahjong wins3menang mahjong pengguna baru di sosial mediamenghargai setiap momen di mahjong waysserunya main mahjong di warung internetspin slow motion mancing scatterstrategi jitu maxwin mahjong waysstrategi jitu menang mahjong modal kecil jackpot besaranak kampung papua menggemparkan mahjongkeajaiban scatter hitam mahjong wayskeberhasilan joni mahjong winskejaiban mahjong ways di ujung jalanketua mahjong wins3 kehadiran kemenangan dimulai dari balimahjong kehadiran yang menguntungkanmahjong menggila adat88panduan kilat raih 108 jutatips memenangkan mahjongbarista kopi menang 110 juta spin mahjongdakota76 scatter hitam mahjong wins 3gagal cpns menang mahjong wins 3 rp120 jutakisah karyawan minimarket dapat thr lebih awal mahjong winskisah pelajar sma kuasai mahjong wins 3 inspirasi sekolahkisah penjaga parkir tanah abang motor baru mahjong winskisah sukses ibu rumah tangga bandung mahjong winsmahasiswa kkn beli iphone15 mahjong wins3 dakotamantan anak band influencer mahjong scatter hitampola rtp senin gates of olympus guru matematikaidola scatter hitam gampang meledakidola sensasi jackpotidola pola scatter hitamidola hasilkan jackpot dalam waktu singkatidola mahjong wins 3 bocortukang cuci motor menemukan keberuntungan di mahjong

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time

Filename: Session/Session.php

Line Number: 282

Backtrace:

File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct

File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once

File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: session_set_cookie_params(): Cannot change session cookie parameters when headers already sent

Filename: Session/Session.php

Line Number: 294

Backtrace:

File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct

File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once

File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time

Filename: Session/Session.php

Line Number: 304

Backtrace:

File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct

File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once

File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time

Filename: Session/Session.php

Line Number: 314

Backtrace:

File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct

File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once

File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time

Filename: Session/Session.php

Line Number: 315

Backtrace:

File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct

File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once

File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time

Filename: Session/Session.php

Line Number: 316

Backtrace:

File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct

File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once

File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time

Filename: Session/Session.php

Line Number: 317

Backtrace:

File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct

File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once

File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time

Filename: Session/Session.php

Line Number: 375

Backtrace:

File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct

File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once

File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time

Filename: drivers/Session_files_driver.php

Line Number: 108

Backtrace:

File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct

File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once

File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: session_set_save_handler(): Cannot change save handler when headers already sent

Filename: Session/Session.php

Line Number: 110

Backtrace:

File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct

File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once

File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: session_start(): Cannot start session when headers already sent

Filename: Session/Session.php

Line Number: 143

Backtrace:

File: /home/blogchuabenh/domains/freetuts.net/public_html/site/controllers/Main_controller.php
Line: 10
Function: __construct

File: /home/blogchuabenh/domains/freetuts.net/public_html/sources/index.php
Line: 299
Function: require_once

File: /home/blogchuabenh/domains/freetuts.net/public_html/index.php
Line: 26
Function: require_once

Các kiểu dữ liệu trong SQL (Data Type) - Freetuts
TABLE QUERIES
DATA QUERIES
CONDITION & OPERATOR
ADVANCED
CÁC CHỦ ĐỀ
BÀI MỚI NHẤT
MỚI CẬP NHẬT

Các kiểu dữ liệu trong SQL (Data Type)

Trong bài này mình sẽ giới thiệu với các bạn các kiểu dữ liệu thường dùng trong các hệ quản trị CSDL như SQL Server, MySQL, Oracle, ... tuy rằng mỗi cái có những kiểu khác nhau nhưng chung quy lại vẫn chưa thành các nhóm chung.

test php

banquyen png
Bài viết này được đăng tại freetuts.net, không được copy dưới mọi hình thức.

Ví dụ:

  • SQL Server có: nvarchar, varchar
  • Oracle có char, varchar2
  • MySQL có varchar, char ...

Vì nó chung quy như vậy nên mình sẽ lấy các kiểu dữ liệu trong SQL Server làm mẫu nhé.

1. Kiểu số nguyên

Đây là kiểu số nhưng là số chẵn và có cả số âm và số dương.

Bài viết này được đăng tại [free tuts .net]

Kiểu Giá trị nhỏ nhất Giá trị lớn nhất
bigint -9,223,372,036,854,775,808 9,223,372,036,854,775,807
int -2,147,483,648 2,147,483,647
smallint -32,768 32,767
tinyint 0 255
bit 0 1
decimal -10^38 +1 10^38 –1
numeric -10^38 +1 10^38 –1
money -922,337,203,685,477.5808 +922,337,203,685,477.5807
smallmoney -214,748.3648 +214,748.3647

2. Kiểu số thực

Là kiểu số cấp phát động, có nghĩa là số có dấu phẩy.

Kiểu Giá trị nhỏ nhất Giá trị lớn nhất
Float -1.79E + 308 1.79E + 308
Real -3.40E + 38 3.40E + 38

3. Kiểu ngày tháng

Là kiểu định dạng ngày tháng.

Kiểu Giá trị nhỏ nhất Giá trị lớn nhất
datetime(3.33 milliseconds accuracy) Jan 1, 1753 Dec 31, 9999
smalldatetime(1 minute accuracy) Jan 1, 1900 Jun 6, 2079
date(1 day accuracy. Introduced in SQL Server 2008) Jan 1, 0001 Dec 31, 9999
datetimeoffset(100 nanoseconds accuracy. Introduced in SQL Server 2008) Jan 1, 0001 Dec 31, 9999
datetime2(100 nanoseconds accuracy. Introduced in SQL Server 2008) Jan 1, 0001 Dec 31, 9999
time(100 nanoseconds accuracy. Introduced in SQL Server 2008) 00:00:00.0000000 23:59:59.9999999

4. Character Strings

Là kiểu ký tự và không hỗ trợ tiếng Việt.

Số thứ tự Kiểu và mô tả
1 char: Chiều dài cố định và tối đa là 8000 ký tự, không hỗ trợ uniccode
2 varchar: Chiều dài cố định và tối đa là 8000 ký tự, không hỗ trợ unicode
3 Varchar (max): Chiều dài cố định và tối đa là 251 ký tự, không hỗ trợ unicode
4 text: Chiều dài cố định và tối đa là 2,147,483,647 characters, không hỗ trợ unicode

5. Unicode Character Strings

Là kiểu ký tự, nó có hỗ trợ tiếng Việt nên thông thường với tiếng Việt thì ta nên chọn kiểu này.

Số thứ tự Kiểu và mô tả
1 nchar: Chiều dài cố định và tối đa là 4000 ký tự, có hỗ trợ unicode
2 nvarchar: Chiều dài cố định và tối đa là 4000 ký tự, có hỗ trợ unicode
3 Nvarchar (max): Chiều dài cố định và tối đa là 230 ký tự, có hỗ trợ unicode
4 ntext: Chiều dài cố định và tối đa là 1,073,741,823 ký tự, có hỗ trợ unicode.

6. Binary Strings

Kiểu này lưu trữ dữ liệu dạng binary, có thể là file ảnh hoặc một file bất kì. Kiểu này rất ít khi sử dụng bởi nếu bạn lưu những file nặng vài MB thì quả là kinh khủng.

Số thứ tự Kiểu và mô tả
1 binary: Chiều dài cố định và tối đa là 8,000 bytes.
2 varbinary: Chiều dài cố định và tối đa là 8,000 bytes.
3 varbinary(max): Chiều dài cố định và tối đa là 231 bytes.
4 image: Chiều dài cố định và tối đa là 2,147,483,647 bytes.

Ngoài ra còn có nhiều loại dữ liệu khác như: timestamp, xml, table, cursor, ... nhưng mình sẽ không đề cập ở bài này, thực tế chỉ có timestamp là dùng nhiều chứ mấy kiểu còn lại rất ít khi dùng, ngay cả khi lưu trữ XML thì bạn cũng dùng text để thay thế.

Trên là các kiểu dữ liệu được sử dụng trong SQL Server, nếu bạn đang học MySQL hay Oracle  thì có thể đọc trên trang tài liệu của nó vì ở đó khá chi tiết. Bài này mình xin dừng ở đây, hẹn gặp lại các bạn ở bài tiếp theo và sẽ là những bài cực kì hấp dẫn với các câu truy vấn.

Cùng chuyên mục:

Phiên làm việc là gì trong SQL

Phiên làm việc là gì trong SQL

Trong bài viết này mình sẽ giải thích phiên làm việc là gì trong SQL…

Ràng buộc Check trong SQL

Ràng buộc Check trong SQL

Bài này bạn sẽ được học cách tạo ràng buộc giá trị trong SQL bằng…

Khóa ngoại Foreign Key trong SQL

Khóa ngoại Foreign Key trong SQL

Trong bài này bạn sẽ được học cách tạo khóa ngoại Foreign Key bằng câu…

Primary Key trong SQL

Primary Key trong SQL

Bài này bạn sẽ được giới thiệu cách tạo khóa chính (Primary Key) thể hiện…

Create và Drop Database trong SQL

Create và Drop Database trong SQL

Bài viết này sẽ hướng dẫn bạn cách sử dụng lệnh Create Database để tạo…

Subquery trong SQL - truy vấn con

Subquery trong SQL - truy vấn con

Trong bài này mình sẽ nói đến một cách sử dụng câu truy vấn SLECT…

Self Join trong SQL

Self Join trong SQL

Mỗi phép Join đều phải có hai bảng table1 và table2, tuy nhiên có trường…

Right Join trong SQL

Right Join trong SQL

Chào các bạn, hôm nay mình sẽ tiếp tục nói đến phép Join trong SQL.…

Left Join trong SQL

Left Join trong SQL

Ở bài trước chúng ta đã được tìm hiểu Inner Join và biết được tại…

Inner JOIN trong SQL

Inner JOIN trong SQL

Ở bài trước chúng ta đã học hiểu cách truy vấn nhiều bảng trong SQL…

Toán tử BETWEEN và NOT BETWEEN trong SQL

Toán tử BETWEEN và NOT BETWEEN trong SQL

Toán tử BETWEEN dùng để kiểm tra một giá trị có nằm trong một khoảng…

Tìm hiểu ALIAS  (AS) trong SQL

Tìm hiểu ALIAS (AS) trong SQL

Trong bài này mình sẽ nói về cách đặt lại tên cho column, table bằng…

Tích đề các trong SQL

Tích đề các trong SQL

Trong bài này mình sẽ hướng dẫn các bạn cách truy vấn dữ liệu trên…

Gộp dữ liệu với UNION và UNION ALL trong SQL

Gộp dữ liệu với UNION và UNION ALL trong SQL

Có một số trường hợp bắt buộc bạn phải chạy hai câu truy vấn nên…

Lọc dữ liệu trùng với DISTINCT trong SQL

Lọc dữ liệu trùng với DISTINCT trong SQL

Đôi khi có những câu truy vấn có kết quả bị trùng lặp thì lúc…

Toán tử AND và OR trong SQL

Toán tử AND và OR trong SQL

Trong bài này chúng ta học hai toán tử có thể nói là được sử…

Toán tử IN và NOT IN trong SQL

Toán tử IN và NOT IN trong SQL

Trong bài này chúng ta sẽ học hai lệnh mới dùng để kiểm tra một…

Toán tử LIKE và NOT LIKE trong SQL

Toán tử LIKE và NOT LIKE trong SQL

Trong bài này chúng ta sẽ tìm hiểu lệnh LIKE, lệnh này dùng để so…

Sắp xếp dữ liệu với ORDER BY trong SQL

Sắp xếp dữ liệu với ORDER BY trong SQL

Nếu bạn muốn sắp xếp dữ liệu trả về theo tăng dần hoặc giảm dần…

Lệnh Delete trong SQL

Lệnh Delete trong SQL

DELETE FROM posts WHERE post_id > 7000 AND post_content IS NOT NULL;

Top