Assignment 2
Assignment 2
SQL Operators refer to the diverse set of symbols and keywords used to
perform various operations on data in relational databases. These operators
include arithmetic, comparison, logical, bitwise, unary, assignment,
membership, NULL-safe equality, and concatenation operators, each
serving specific purposes in crafting efficient SQL queries.
• Difference between, Primary Key, Unique Key, Candidate Key , Foreign key?
Primary Key Unique Key
•It is used to serve as a unique •It is uniquely determines a row
identifier for each row in a table. that isn’t the primary key.
• It cannot accept NULL values. •It can accept NULL values.
•It has only one primary key. •It has more than one unique key.
•The primary Key is used for •The Unique Key is used for
indicating the rows uniquely. preventing duplicate entries.
CREATE TABLE
your_schema_name.your_table_name (
id SERIAL PRIMARY KEY,
column1 VARCHAR(255) NOT NULL,
column2 INT,
created_at TIMESTAMP DEFAULT
CURRENT_TIMESTAMP
);
• What is Indexing, Type of Indexing, why we use it,
how to use it in day today activity.
Indexing is a database optimization technique that improves the speed of data
retrieval operations on a database table. An index is a data structure that allows
for quick lookups and retrieval of rows from a database table based on the values
in one or more columns.
Types of Indexing:
1. Primary Index
2. Secondary Index
3. Unique Index
4. Composite Index
5. Full-Text Index
6. Bitmap Index:
Day to day activities are as follows: