MySQL- tutoriaal

MySQL TUIS MySQL-inleiding MySQL RDBMS

MySQL SQL

MySQL SQL MySQL KIES MySQL WAAR MySQL EN, OF, NIE MySQL BESTEL DEUR MySQL VOEG IN MySQL NULL-waardes MySQL-OPDATERING MySQL SKEE MySQL-LIMIET MySQL MIN en MAX MySQL COUNT, AVG, SUM MySQL LIKE MySQL Wildcards MySQL IN MySQL TUSSEN MySQL aliasse MySQL sluit aan MySQL BINNE SLUIT AAN MySQL LOS LINKS AAN MySQL REGS SLUIT AAN MySQL KRUIS SLUIT AAN MySQL Self Sluit aan MySQL UNIE MySQL GROEP DEUR MySQL HET MySQL BESTAAN MySQL ENIGE, ALMAL MySQL INSERT SELECT MySQL-GEVAL MySQL nul-funksies MySQL-kommentaar MySQL-operateurs

MySQL- databasis

MySQL Skep DB MySQL Drop DB MySQL Skep tabel MySQL Drop Table MySQL Verander Tabel MySQL-beperkings MySQL nie nul nie MySQL Uniek MySQL-primêre sleutel MySQL buitelandse sleutel MySQL-tjek MySQL verstek MySQL Skep indeks MySQL Outo-verhoging MySQL-datums MySQL-aansigte

MySQL- verwysings

MySQL-datatipes MySQL-funksies

MySQL voorbeelde

MySQL voorbeelde MySQL Vasvra MySQL-oefeninge

MySQL SUBSTRING() Funksie

❮ MySQL-funksies

Voorbeeld

Onttrek 'n substring uit 'n string (begin by posisie 5, onttrek 3 karakters):

SELECT SUBSTRING("SQL Tutorial", 5, 3) AS ExtractString;

Definisie en gebruik

Die SUBSTRING()-funksie onttrek 'n substring uit 'n string (begin by enige posisie).

Let wel: Die SUBSTR()- en MID()- funksies is gelyk aan die SUBSTRING()-funksie.

Sintaksis

SUBSTRING(string, start, length)

OF:

SUBSTRING(string FROM start FOR length)

Parameterwaardes

Parameter Description
string Required. The string to extract from
start Required. The start position. Can be both a positive or negative number. If it is a positive number, this function extracts from the beginning of the string. If it is a negative number, this function extracts from the end of the string
length Optional. The number of characters to extract. If omitted, the whole string will be returned (from the start position)

Tegniese besonderhede

Werk in: Van MySQL 4.0

Meer voorbeelde

Voorbeeld

Onttrek 'n substring uit die teks in 'n kolom (begin by posisie 2, onttrek 5 karakters):

SELECT SUBSTRING(CustomerName, 2, 5) AS ExtractString
FROM Customers;

Voorbeeld

Onttrek 'n substring uit 'n string (begin van die einde, by posisie -5, onttrek 5 karakters):

SELECT SUBSTRING("SQL Tutorial", -5, 5) AS ExtractString;

❮ MySQL-funksies