Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save chandra-prakash-meghwal/8c14a2ad1a489340cf627213da701e22 to your computer and use it in GitHub Desktop.
Save chandra-prakash-meghwal/8c14a2ad1a489340cf627213da701e22 to your computer and use it in GitHub Desktop.
an sql query example to create a table with column having data type bigserial, integer, bigint, boolean, varchar and specified primary key
/*create a sample table with table name user_credits and columns id primary key, username, credit_assigned, credit_expire_time, is_user_kyced*/
CREATE TABLE user_credits (id BIGSERIAL PRIMARY KEY, username VARCHAR(25), credit_assigned integer, credit_expire_time bigint, is_user_kyced boolean);
/*
bigserial 8 bytes large autoincrementing integer 1 to 9223372036854775807
integer 4 bytes typical choice for integer -2147483648 to +2147483647
bigint 8 bytes large-range integer -9223372036854775808 to +9223372036854775807
boolean 1 byte state of true or false
VARCHAR(size) A VARIABLE length string (can contain letters, numbers, and special characters). The size parameter specifies the maximum string length in characters - can be from 0 to 65535
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment