GET

GET in SQL does not exist as a standalone command or operation. Typically, in the context of SQL, one retrieves data using the SELECT statement. However, the term "GET" is often used in the context of RESTful services or HTTP when retrieving information from a database or web server.

Example

SELECT * FROM Employees WHERE EmployeeID = 1;

Output

| EmployeeID | FirstName | LastName | JobTitle |
|------------|-----------|----------|------------|
| 1 | John | Doe | Developer |

Explanation

The SELECT statement displayed retrieves all columns (*) for the employee with an EmployeeID of 1 in the Employees table. The output then shows the record of this employee with their ID, first name, last name, and job title.

Example

SELECT * FROM employees WHERE id = 1;

Output

id | name | position
----+------+---------
1 | John | Manager

Explanation

The given SQL command retrieves all columns(*) for the record from the ‘employees’ table where the ‘id’ is 1. The returned output shows that there is an employee named ‘John’ who has the position ‘Manager’ and an ‘id’ value of 1.

Example

SELECT FirstName, LastName
FROM Employees
WHERE EmployeeID = 1;

Output

| FirstName | LastName |
|-----------|----------|
| John | Doe |

Explanation

The example query fetches the first and last name from the Employees table where the EmployeeID is 1.

Oracle SQL does not have a GET method since it’s not REST-based. Instead, it uses SELECT statements to fetch data. Let’s show an example of how to retrieve data:

Example
SELECT first_name, last_name
FROM employees
WHERE employee_id = 100;

Output

FIRST_NAME LAST_NAME
------------ ------------
Steven King

Explanation

In the given example, the SELECT statement is used to fetch the first_name and last_name of the employee from the ‘employees’ table where the employee_id is 100. The output shows that the employee with ID 100 is Steven King.

Example

SELECT * FROM Employees WHERE Age > 25;

Output

| ID | NAME | AGE |
|----|------------|-----|
| 2 | Tom | 32 |
| 4 | Jerry | 27 |
| 6 | Mick | 28 |

Explanation

The SQL statement selects all the records from the table “Employees” where “Age” is greater than 25. The output table displays the ID, name, and age of employees that meet the condition.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.