What is a view in SQL? How to create one
Ans: A view is a virtual table based on the result-set of an SQL statement. We can create using create view syntax.
CREATE VIEW view_name AS
SELECT column_name(s)
FROM table_name
WHERE condition
What is SQL?
SQL is Structured Query Language designed for inserting and modifying in a relational database system.
Primary keys cannot have NULL value, the unique constraints can have NULL values. There is only one primary key in a table, but there can be multiple unique constraints.
Normalisation
Normalization is process for assigning attributes to entities
- Reduces data redundancies
- Helps eliminate data anomalies
- Produces controlled redundancies to link tables
Normalization stages
- 1NF – First normal form:
- No data redundancy
- No data consistency
- No insertion
- No deletion
- 2NF – Second normal form:
- Insertion
- Updating
- Deletion
- 3NF – Third normal form
- No data reduce
- No insertion or deletion
- No updation
- 4NF – Fourth normal form
Joins
Join tool from the Join tool palette.
Rather than connecting the Left (L) output, J (J) output, and the Right (R) from the Join outputs to the Union tool, the Join Multiple tool can be used to provide an all records output.
pd.merge() is a pandas function used to combine two DataFrames based on one or more common columns, similar to SQL joins. pd.merge() defaults to an inner join because it only returns rows with matching keys in both DataFrames