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

Toán tử GLOB trong SQLite - Freetuts
CĂN BẢN
NÂNG CAO
CÁC CHỦ ĐỀ
BÀI MỚI NHẤT
MỚI CẬP NHẬT

Toán tử GLOB trong SQLite

Toán tử GLOB trong SQLite được sử dụng để so sánh các giá trị với một mẫu (pattern) bằng cách sử dụng ký tự đại diện (wildcards). Nếu biểu thức tìm kiếm khớp với biểu thức mẫu, toán tử GLOB sẽ trả về true, là 1. Toán tử GLOB không giống như toán tử LIKE, toán tử GLOB phân biệt chữ hoa chữ thường và nó tuân theo cú pháp của UNIX để chỉ định các ký tự đại diện như sau:

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.
  • The asterisk sign (*)
  • The question mark (?)

The asterisk sign (*) dùng để đại diện cho 0 hoặc nhiều ký tự. The question mark (?) đại diện cho một ký tự đơn.

1. Cú pháp của toán tử * và toán tử ? trong SQlite

Cú pháp cơ bản của toán tử * và toán tử ? trong SQLite như sau:

SELECT FROM table_name
WHERE column GLOB 'XXXX*'
or 
SELECT FROM table_name
WHERE column GLOB '*XXXX*'
or
SELECT FROM table_name
WHERE column GLOB 'XXXX?'
or
SELECT FROM table_name
WHERE column GLOB '?XXXX'
or
SELECT FROM table_name
WHERE column GLOB '?XXXX?'
or
SELECT FROM table_name
WHERE column GLOB '????'

Bạn có thể kết hợp N số điều kiện bằng cách sử dụng toán tử AND hoặc OR. Ở đây, XXXX có thể là bất kỳ giá trị số hoặc chuỗi nào.

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

2. Ví dụ của toán tử * và toán tử ? trong SQLite

Bảng sau đây sẽ liệt kê một số ví dụ cho thấy sự kết hợp giữa mệnh đề WHERE, toán tử LIKE và toán tử  '*' và toán tử '?'

Câu lệnh Mô tả
WHERE SALARY GLOB '200*' Tìm bất kỳ giá trị nào bắt đầu bằng 200
WHERE SALARY GLOB '*200*' Tìm bất kỳ giá trị nào có 200 ở bất kỳ vị trí nào
WHERE SALARY GLOB '?00*' Tìm bất kỳ giá trị nào có 00 ở vị trí thứ hai và thứ ba
WHERE SALARY GLOB '2??' Tìm bất kỳ giá trị nào bắt đầu bằng 2 và có ít nhất 3 ký tự
WHERE SALARY GLOB '*2' Tìm bất kỳ giá trị nào kết thúc bằng 2
WHERE SALARY GLOB '?2*3' Tìm bất kỳ giá trị nào có 2 ở vị trí thứ hai và kết thúc bằng 3
WHERE SALARY GLOB '2???3' Tìm bất kỳ giá trị nào trong một số có năm chữ số bắt đầu bằng 2 và kết thúc bằng 3

Giả sử chúng ta có bảng COMPANY có các dòng dữ liệu sau:

ID          NAME        AGE         ADDRESS     SALARY
----------  ----------  ----------  ----------  ----------
1           Paul        32          California  20000.0
2           Allen       25          Texas       15000.0
3           Teddy       23          Norway      20000.0
4           Mark        25          Rich-Mond   65000.0
5           David       27          Texas       85000.0
6           Kim         22          South-Hall  45000.0
7           James       24          Houston     10000.0

Ví dụ sau đây sẽ hiển thị tất cả các bản ghi từ bảng COMPANY trong đó age bắt đầu bằng 2.

sqlite> SELECT * FROM COMPANY WHERE AGE  GLOB '2*';

Kết quả của ví dụ trên như sau:

ID          NAME        AGE         ADDRESS     SALARY
----------  ----------  ----------  ----------  ----------
2           Allen       25          Texas       15000.0
3           Teddy       23          Norway      20000.0
4           Mark        25          Rich-Mond   65000.0
5           David       27          Texas       85000.0
6           Kim         22          South-Hall  45000.0
7           James       24          Houston     10000.0

Ví dụ sau đây sẽ hiển thị tất cả các bản ghi trong bảng COMPANY trong đó address có dấu gạch nối (-) bên trong giá trị.

sqlite> SELECT * FROM COMPANY WHERE ADDRESS  GLOB '*-*';

Và kết quả của ví dụ trên như sau:

ID          NAME        AGE         ADDRESS     SALARY
----------  ----------  ----------  ----------  ----------
4           Mark        25          Rich-Mond   65000.0
6           Kim         22          South-Hall  45000.0

Cùng chuyên mục:

Các hàm hữu ích trong SQLite

Các hàm hữu ích trong SQLite

SQLite có nhiều hàm dựng sẵn để thực hiện xử lý trên dữ liệu chuỗi…

Date & Time trong SQLite

Date & Time trong SQLite

SQLite hỗ trợ năm hàm ngày và giờ như date(timestring, modifiers...), time(timestring, modifiers...), datetime(timestring, modifiers...),…

VACUUM trong SQLite

VACUUM trong SQLite

Lệnh VACUUM trong SQLite làm sạch cơ sở dữ liệu chính bằng cách sao chép…

EXPLAIN trong SQLite

EXPLAIN trong SQLite

Câu lệnh SQLite có thể được bắt đầu bằng từ khóa "EXPLAIN" hoặc bằng cụm…

SQL Injection trong SQLite

SQL Injection trong SQLite

Nếu bạn nhận user input thông qua một Webpage và chèn nó vào trong một…

Tăng tự động AUTOINCREMENT trong SQLite

Tăng tự động AUTOINCREMENT trong SQLite

AUTOINCREMENT trong SQLite là một từ khóa được sử dụng để tự động tăng giá…

Subquery trong SQLite

Subquery trong SQLite

Subquery hoặc Inner query hoặc Nested query là một truy vấn bên trong một truy…

Transaction trong SQLite

Transaction trong SQLite

Một transaction là một đơn vị công việc được thực hiện đối với một cơ…

Tìm hiểu View trong SQLite

Tìm hiểu View trong SQLite

Một view không có gì khác hơn một câu lệnh SQLite được lưu trữ trong…

Lệnh TRUNCATE TABLE trong SQLite

Lệnh TRUNCATE TABLE trong SQLite

Thật không may, không có lệnh TRUNCATE TABLE trong SQLite nhưng bạn có thể sử…

Lệnh ALTER TABLE trong SQLite

Lệnh ALTER TABLE trong SQLite

Lệnh ALTER TABLE trong SQLite dùng để sửa đổi một bảng hiện có mà không…

Mệnh đề INDEXED BY trong SQLite

Mệnh đề INDEXED BY trong SQLite

Mệnh đề "INDEXED BY index-name" chỉ định rằng index-name phải được sử dụng để tìm…

Index trong SQLite

Index trong SQLite

Index là bảng tra cứu đặc biệt mà database search engine có thể sử dụng…

Tìm hiểu Trigger trong SQLite

Tìm hiểu Trigger trong SQLite

Trigger trong SQLite là các hàm callback, mà tự động được thực hiện/gọi (performed/invoked) khi…

Cú pháp ALIAS trong SQLite

Cú pháp ALIAS trong SQLite

Bạn có thể đổi tên tạm thời một bảng hoặc một cột bằng cách đặt…

Toán tử UNION trong SQLite

Toán tử UNION trong SQLite

Toán tử UNION trong SQLite được sử dụng để kết hợp các kết quả của…

Lệnh JOIN trong SQLite

Lệnh JOIN trong SQLite

Lệnh JOIN trong SQLite được sử dụng để kết hợp các bản ghi từ hai…

Các ràng buộc Constraint trong SQLite

Các ràng buộc Constraint trong SQLite

Các ràng buộc (Constraints) là các quy tắc được thi hành trên một cột dữ…

Lệnh PRAGMA trong SQLite

Lệnh PRAGMA trong SQLite

Lệnh PRAGMA trong SQLite là một lệnh đặc biệt được sử dụng để kiểm soát…

Từ khóa DISTINCT trong SQLite

Từ khóa DISTINCT trong SQLite

Từ khóa DISTINCT trong SQLite được sử dụng cùng với câu lệnh SELECT để loại…

Top