DBMS and RDBMS
Database Management System is a program that controls creation/maintenance/use of a database. RDBMS stores the data into the collection of tables, which is related by common fields between the columns of the table.
View is a saved query (table based on the result-set). A view always shows up-to-date data
CREATE VIEW [My new view] AS SELECT column1, column2 FROM myTable WHERE column1 = "value";
SELECT * FROM [My new view];
Update a view
CREATE OR REPLACE VIEW [My new view] AS SELECT...
DROP VIEW [My new view];
Input field accepts an malicious SQL statement.
1. 1=1 is Always True -> passwords
2. “”=”” is Always True
3. Batched SQL Statements -> 105; DROP TABLE Suppliers
A batch is a group of two or more statements, separated by semicolons.
Use parameters for protection:
string1 = “”string;
query = “INSERT INTO myTable (myColumn) Values(@0)”;
Process of minimizing redundancy and dependency by organizing fields into tables. Add/delete/modify a field that can be saved in a table.
There are 4 Normal Forms:
1NF (First Normal Form)
- each cell to be single values
- entries in columns to be same type
- rows to be uniquely identified (add unique ID or add columns to make rows unique)
- separating data into tables and creating relationships between these tables using, primary keys
- removing columns that aren’t dependent on primary key
- no multi-valued dependencies
- clustered index
- non-clustered index
- one to one relationship
- one to many relationship
- many to one relationship
- self-referencing relationship