Get all records in SQL, Python and R

Posted On Saturday, June 1, 2019

Given a table or dataframe named students as shown below, get all the records from the table or dataframe.

| ---------- | ------------ | ------------ | --------------- |
| student_id | student_name | student_city | student_country |
| ---------- | ------------ | ------------ | --------------- |
| 1          | John         | Atlanta      | USA             |
| ---------- | ------------ | ------------ | --------------- |
| 2          | Hari         | Mumbai       | India           |
| ---------- | ------------ | ------------ | --------------- |
| 3          | Ali          | Dubai        | UAE             |
| ---------- | ------------ | ------------ | --------------- |
| 4          | Jenny        | Berlin       | Germany         |
| ---------- | ------------ | ------------ | --------------- |
| 5          | Lisa         | Berlin       | Germany         |
| ---------- | ------------ | ------------ | --------------- |
| 6          | Priya        | Delhi        | India           |
| ---------- | ------------ | ------------ | --------------- |
| 7          | Wong         | Beijing      | China           |
| ---------- | ------------ | ------------ | --------------- |
| 8          | Julius       | Rome         | Italy           |
| ---------- | ------------ | ------------ | --------------- |
| 9          | Alonso       | Atlanta      | USA             |
| ---------- | ------------ | ------------ | --------------- |
| 10         | Noor         | London       | UK              |
| ---------- | ------------ | ------------ | --------------- |

Select all rows using SQL:

SELECT * FROM students

Select all rows using Python:

You must have the pandas library installed to run this snippet of code.

import pandas as pd

students

Select all rows using R:

students

Result:

student_id student_name student_city student_country
         1         John      Atlanta             USA
         2         Hari       Mumbai           India
         3          Ali        Dubai             UAE
         4        Jenny       Berlin         Germany
         5         Lisa       Berlin         Germany
         6        Priya        Delhi           India
         7         Wong      Beijing           China
         8       Julius         Rome           Italy
         9       Alonso      Atlanta             USA
        10         Noor       London              UK