Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

PostgreSQL Basic SELECT Statement: Select first ten records from a table


18. Write a query to select first ten records from a table.

Sample Solution:

Code:

SELECT employee_id, first_name 
FROM employees  LIMIT 10;

Sample table: employees


Output:

pg_exercises=# SELECT employee_id, first_name
pg_exercises-# FROM employees  LIMIT 10;
 employee_id | first_name
-------------+------------
         100 | Steven
         101 | Neena
         102 | Lex
         103 | Alexander
         104 | Bruce
         105 | David
         106 | Valli
         107 | Diana
         108 | Nancy
         109 | Daniel
(10 rows)

Practice Online



Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a query to check whether the first_name column of the employees table containing any number.
Next: Write a query to get a monthly salary (rounded up to 2 decimal places) of each employee.

What is the difficulty level of this exercise?