Conditional modification:
Update table name set column name = value where column name = value
Conditional Delete:
Delete from table name where column name = value
Advanced Query
Conditional query
Check column * Instead of columns to view, comma separated by multiple columns
Filter criteria where column name = >= <= > < value and OR
Fuzzy query
SELECT * FROM table name where column name like '% value% '% wildcard
Sort queries
SELECT * FROM table name where order by column name Asc/desc
Go to re-query
Select DISTINCT column name from table name
Group queries
Select a column name from table name GROUP by
Sub-query
Use a query statement as a value
ALTER TABLE FOREIGN KEY table name add constraint constraint name foreign key (foreign key field) references primary key table name (constraint column name)
If the IDs in table A are primary keys, to constrain the aid column in table B, then the statement should be:
ALTER TABLE B add constraint a_b_ids foreign key (Aid) references A (IDS)
2017-3-10 SQL Server T-SQL statement advanced query