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:
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
Output
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.