METHOD

METHOD in SQL is a pre-defined function embedded within an Object-oriented database. It is used to manipulate the data stored in a database object or to perform operations relative to that object. METHODS can include routines and functions specific to a object's data. They exist within a class related to a specific object and differ from standard SQL functions.

Example

Here is a simple SQL command using PostgreSQL:

CREATE TABLE all_games (
title varchar(100),
developer varchar(100),
year_published int
);

Output

On running the above command, no explicit output is returned on successful execution in PostgreSQL.

Explanation

The above SQL command creates a new table named all_games using CREATE TABLE statement in PostgreSQL. This table includes three columns: title (type varchar(100)), developer (type varchar(100)), and year_published (type int).

In Oracle SQL, one of the commonly used methods is the SELECT statement, which is used to select data from a database.

Example

SELECT * FROM Employees;

Output

1 John Doe 30
2 Jane Doe 25
3 Alice Smith 35
4 Bob Jones 40

Explanation

The SELECT statement is used to select data from a database. The data that is being returned by this statement will be from the columns in the Employees table. The asterisk (*) is used to indicate that we want to select all columns.

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