Tipuri de date SQL

postat acum 4 ani de Stefanescu Mihai in categorie SQL

Tipurile de date din SQL ne ajuta sa specificam tipul de date ce poate fi primit de o anumita coloana a unui tabel.

Puteti defini aceste tipuri de date la crearea unui tabel.

Aceste tipuri de date se impart in 4 categorii:

  • Numerice
  • Data/Timp
  • String
  • Binar

Tipul de date Numerice

Tipul De La Pana La
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
 float -1.79E + 308  1.79E + 308
 real  -3.40E + 38  3.40E + 38

Data si Timpul

Tipul De La Pana La
datetime 1 Ianuarie 1753 31 Decembrie 9999
smalldatetime 1 Ianuarie 1900 6 Iunie 2079
date Salveaza o data in formatul: June 30, 1991
time Salveaza timpul in formatul: 12:30 P.M

Stringuri

Tipul De La Pana La
 char  — Pana la o lungime de 8000 caractere (Lungime fixa).
 varchar  — Pana la o lungime de 8000 caractere (Lungime variabila)
 varchar(max)  —  Lungime maxima de 231 caractere (Lungime variabila).
 text  — Lungime variabila, maxim 2,147,483,647 caractere.
 nchar  —  Pana la o lungime de 4000 caractere (Lungime fixa).
 nvarchar  —  Pana la o lungime de 4000 caractere (Lungime variabila).
 nvarchar(max)  —  Lungime maxima de 231 caractere (Lungime variabila).
 ntext  —  Lungime variabila, maxim 1,073,741,823 caractere.

Date Binare

Tipul Descrierea
binary Lungime maxima de 8000 caractere (Lungime Fixa)
varbinary Lungime maxima de 8000 caractere (Lungime Variabila)
varbinary(max) Lungime maxima de 231 caractere (Lungime Variabila)
image Lungime maxima de 2,147,483,647 bytes. ( Lungime variabila)

Alte tipuri de date

Tipul Descrierea
sql_variant Stocheaza valoarile diverselor tipuri de date SQL Server, cu exceptia text, ntext si timestamp
timestamp Stocheaza un numar unic ce se updateaza de fiecare data cand un rand este updatat
uniqidentifier Stocheaza un identificator global unic (GUID)
xml Stocheaza date XML.
cursor Referinta catre un obiect de tip cursor.
table Stocheaza un rezultat pentru oprocesare ulterioara.
Sunt un tanar programator din Bucuresti ce lucreaza in PHP/Mysql (MySqli/PDO), Laravel, CodeIgniter, MySQL, PostgreSQL, Wordpress, HTML5/CSS3, Sass, Photoshop si multe altele.
Google+ Community Facebook Group
Acest articol a fost mutat de pe vechea platforma.
Pentru orice eroare aparuta la mutare va rog sa ma contactati!

Comentariu postate de download minecraft la data de 14.05.2019
Hey there, You have done a fantastic job. I will definitely digg it and personally recommend to my friends. I'm confident they'll be benefited from this website.
Comentariu postate de minecraft download mojang la data de 15.05.2019
Hi, after reading this remarkable paragraph i am also happy to share my know-how here with mates.
Comentariu postate de minecraft download free la data de 15.05.2019
It's an amazing piece of writing in support of all the online visitors; they will get advantage from it I am sure.
Comentariu postate de download minecraft for free la data de 16.05.2019
Hello there! This blog post could not be written much better! Looking at this article reminds me of my previous roommate! He always kept preaching about this. I am going to forward this article to him. Fairly certain he's going to have a very good read. Many thanks for sharing!
Comentariu postate de minecraft download la data de 16.05.2019
Hey would you mind letting me know which web host you're utilizing? I've loaded your blog in 3 different internet browsers and I must say this blog loads a lot quicker then most. Can you recommend a good hosting provider at a fair price? Thanks a lot, I appreciate it!
Comentariu postate de minecraft download free la data de 17.05.2019
My family always say that I am killing my time here at web, however I know I am getting experience every day by reading such pleasant content.