LANGUAGE

LANGUAGE in SQL is a defined parameter of a function, indicating the programming language in which the function is implemented. The LANGUAGE clause can be written as LANGUAGE SQL, LANGUAGE C, or LANGUAGE INTERNAL depending on the language of the written code. It's required in the function's definition and is a key component in determining how the function operates within the SQL environment.

Example

CREATE TABLE employees (
ID INT NOT NULL,
name VARCHAR (20) NOT NULL,
salary FLOAT NOT NULL,
start_date DATE,
city VARCHAR (20),
PRIMARY KEY (ID)
);
INSERT INTO employees (ID, name, salary, start_date, city)
VALUES (1, 'John Doe', 75000, '2022-01-31', 'New York');
SELECT * FROM employees;

Output

ID | name | salary | start_date | city
----|----------|--------|------------|---------
1 | John Doe | 75000 | 2022-01-31 | New York

Explanation

The example demonstrates the syntax to create a table titled ‘employees’ in PostgreSQL. Following the table’s initialization, one record is inserted using the INSERT INTO statement. The record is then retrieved using the SELECT * FROM employees; query which fetches all records from the employees table. The output shows the returned record in tabulated format.

Example

SELECT FirstName, LastName
FROM Employees
WHERE EmployeeID = 1;

Output

FirstName | LastName
--------- | --------
John | Smith

Explanation

The SQL statement selects and displays the first name and last name from the Employees table for the record where the EmployeeID is 1.

Example

SELECT
SYSDATE Current_Date,
TO_CHAR(SYSDATE, 'Month') Current_Month
FROM
dual;

Output

CURRENT_DATE CURRENT_MONTH
24-MAR-22 March

Explanation

The provided SQL code retrieves the current date and month using Oracle’s SYSDATE function. The TO_CHAR function then converts the date value to return just the name of the current month.

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