Database Reference
In-Depth Information
Inserting data into the foo table using the following statements:
warehouse_db=# INSERT INTO foo values(1, 'foo', 'pass');
warehouse_db=# INSERT INTO foo values(2, 'bar', 'passwd');
Using the SELECT statement in the foo table:
warehouse_db=# SELECT * FROM foo;
id | username | password
----+----------+----------------
1 | foo | :5METYeTF6VjvI
2 | bar | :n/2sTOY2rduYs
(2 rows)
Using the SELECT statement in the foo table where pass is the password :
warehouse_db=# SELECT * FROM foo WHERE password = 'pass';
id | username | password
----+----------+----------------
1 | foo | :5METYeTF6VjvI
(1 row)
The citext extension
The citext extension provides a case-insensitive character string type. Its value is
irst converted into lower case before comparing. We normally need to apply either
the lower or upper function to perform a case-insensitive search.
Creating the citext extension using the following statement:
warehouse_db=# CREATE EXTENSION citext;
Creating the foo_new table using the following statement:
warehouse_db=# CREATE TABLE foo_new (id INTEGER, fname TEXT, lname
CITEXT);
Inserting data into the foo_new table using the following statements:
warehouse_db=# INSERT INTO foo_new VALUES(1, 'foo', 'bar');
Using the SELECT statement in the foo_new table with fname as Foo :
warehouse_db=# SELECT * FROM foo_new WHERE fname = 'Foo';
id | fname | lname
----+-------+-------
(0 row)
 
Search WWH ::




Custom Search