--Return first 100 records from the table employee.
SELECT * FROM employee LIMIT 100
--Return 10 records from the table employee starting at row 5
SELECT * FROM employee LIMIT 10 OFFSET 5
--Alter table, create unique sequenced column on existing table.
CREATE SEQUENCE my_ids;
ALTER TABLE mytable ADD id INT UNIQUE;
UPDATE mytable SET id = NEXTVAL('my_ids');
--Find duplicate entries of many columns
select key1,key2,count(*)
from table
group by key1,key2
having count(*) > 1
order by 3 desc;
Just some useful reminders of how to do a bunch of thing ins postgresql
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.