Sql constraints

constraints in sql # The most common constraints are NOT NULL # Ensures a column cannot have a NULL value UNIQUE # Ensures all values in a column are unique PRIMARY KEY # Identifies a record in a table, is NOT NULL & UNIQUE FOREIGN KEY # References a unique record from another table CHECK […]

Sql constraints Read More

Sql constraint query

sql constraint query — Note: this is for Oracle only select * from USER_CONSTRAINTS where TABLE_NAME = ‘<your-table-name>’;</your-table-name> constraints in sql # The most common constraints are NOT NULL # Ensures a column cannot have a NULL value UNIQUE # Ensures all values in a column are unique PRIMARY KEY # Identifies a record in […]

Sql constraint query Read More

Sql condition on temporary column

sql condition on temporary column — NOTE: this is for SQL-Oracle specifically — syntax: SELECT * FROM ( SELECT <column_1_value> <column_1_temp_name> ,<column_2_value> <column_2_temp_name> ,<column_3_value> <column_3_temp_name> FROM <_table_name_> ) WHERE <condition_including:<temp_column_name> >; — example: SELECT * FROM ( SELECT (AMOUNT) TOTAL — note: NOT … as “col_1” ,((AMOUNT) + (TAX)) TOTAL_WITH_TAX ,((AMOUNT) – (DISCOUNT)) TOTAL_WITH_DISC FROM […]

Sql condition on temporary column Read More

Sql compiler

sql online compiler This is a good SQL editor: https://www.tutorialspoint.com/execute_sql_online.php sql compiler I recomend popSql or online: https://www.tutorialspoint.com/execute_sql_online.php

Sql compiler Read More

Sql compare data from two tables

sql difference between tables — Oracle — Example SELECT * FROM Table1 — the table containing extra records MINUS SELECT * FROM Table2; — Syntax SELECT * FROM <table-1> — the table containing extra records MINUS SELECT * FROM <table-2>;</table-2></table-1> sql compare data from two tables select * from tableA minus select * from tableB

Sql compare data from two tables Read More