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?
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework