BIGINT
Example
Section titled “Example”CREATE TABLE Employees ( ID BIGINT, Name VARCHAR(100));
INSERT INTO Employees(ID, Name)VALUES (12345678901234, 'John Doe');Output
Section titled “Output”Query OK, 1 row affected (0.01 sec)Explanation
Section titled “Explanation”In the provided example, a table named ‘Employees’ is created with two columns: ID and Name. The ID column is declared with BIGINT data type to store large integer values. A new row has been inserted into this table with an ID value of 12345678901234, illustrating the use of BIGINT for large integers.
Example
Section titled “Example”CREATE TABLE Employees ( ID BIGINT, Name TEXT);
INSERT INTO Employees (ID, Name) VALUES (9223372036854775807, 'John Smith');Output
Section titled “Output”SELECT * FROM Employees;
ID | Name---------------------+------------- 9223372036854775807 | John SmithExplanation
Section titled “Explanation”The BIGINT datatype is used to store large numbers. It can store numbers from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. In the example, we have created an Employees table with ID as a BIGINT and Name as TEXT. Then we inserted a row with ID as the maximum value a BIGINT can hold.
Example
Section titled “Example”CREATE TABLE Example( ID BIGINT, Name VARCHAR(50));
INSERT INTO Example(ID, Name) VALUES(9223372036854775807, 'ExampleName');SELECT * FROM Example;Output
Section titled “Output”ID | Name------------------------|-----------9223372036854775807 | ExampleNameExplanation
Section titled “Explanation”In this example, a table named Example is created with two columns: ID and Name. The ID column uses the BIGINT data type, which can store large integer numbers. A row is inserted into the Example table with the ID value is the maximum allowed for a BIGINT value (9223372036854775807), and a SELECT * query is executed to return all row(s) from the Example table.
Example
Section titled “Example”CREATE TABLE Employee ( ID BIGINT, Name VARCHAR2(100));
INSERT INTO Employee (ID, Name)VALUES (1234567890123456789, 'John Doe');
SELECT * FROM Employee;Output
Section titled “Output”ID | Name---------------------|-----------------1234567890123456789 | John DoeExplanation
Section titled “Explanation”In this example, a table Employee is created with two columns: ID of data type BIGINT and Name of data type VARCHAR2(100). One record is inserted with ID as 1234567890123456789 and Name as John Doe. The SELECT statement retrieves all the records from the Employee table.
Example
Section titled “Example”CREATE TABLE Employees ( ID BIGINT PRIMARY KEY, NAME TEXT NOT NULL, AGE INT NOT NULL, SALARY DEC NOT NULL);
INSERT INTO Employees (ID, NAME, AGE, SALARY)VALUES (12345678910, 'John Doe', 30, 50000);
SELECT * FROM Employees;Output
Section titled “Output”ID | NAME | AGE | SALARY------------- |--------- | --- | ------12345678910 | John Doe | 30 | 50000Explanation
Section titled “Explanation”In the CREATE TABLE statement, a table called Employees is generated and the ID column is declared to be of BIGINT type which is a large-sized integer. BIGINT is used when the data to be stored is expected to exceed the storage size of usual integer types. The table also includes NAME, AGE and SALARY columns of types TEXT, INT, and DEC respectively.
Then an INSERT INTO statement is used to insert values (‘John Doe’, 30, 50000) into the columns of Employees table where the ID is 12345678910, exhibiting the purpose of BIGINT type, capable of storing much larger numbers.
The SELECT * FROM Employees; statement extracts and shows all records from the Employees table, as seen in the output.