Professional Documents
Culture Documents
High-level language: High-level languages are programming languages that are designed to be easily
understood by humans. They are closer to natural language
Low-level language: Low-level languages are programming languages that are closer to the machine
code and hardware architecture.
Compiler: A compiler is a program that translates the entire source code of a high-level programming
language into machine code or an intermediate code in a single compilation process.
Interpreter: An interpreter is a program that reads and executes the source code of a high-level
programming language line by line.
Database: A database is a structured collection of data that is organized and stored in a way that makes it
easy to manage, retrieve, and update.
RDBMS: A Relational Database Management System (RDBMS) is a software system that manages and
organizes data in a relational database. It is based on the principles of the relational model
SQL: Structured Query Language, is a domain-specific programming language designed for managing
and manipulating relational databases. SQL provides a standardized way to interact with relational
database management systems (RDBMS)
SQL Commands:
Syntax:
Syntax:
column1 datatype,
column2 datatype,
...
);
Syntax:
· DROP TABLE: Removes a table and its data from the database.
Syntax:
· TRUNCATE : used to quickly and efficiently remove all rows from a table
Syntax:
Syntax:
Syntax:
Order By: The ORDER BY clause in SQL is used to sort the result set of a query based on one or more
columns. It is particularly useful when you want to retrieve data in a specific order, such as ascending or
descending order, and is commonly used in conjunction with the SELECT statement.
For Ascending
FROM table
For Descending
FROM table
Primary Key : A primary key is a column or set of columns in a table that uniquely identifies each record
in that table. It must contain unique values, and no NULL values are allowed. A table can have only one
primary key
Foreign Key: A foreign key is a column or set of columns in a table that refers to the primary key of
another table. It establishes a link between the two tables, creating a relationship.
NOT NULL Constraint: The NOT NULL constraint ensures that a column cannot have NULL values. It
requires each row to have a value for that column.
Unique Constraint:The UNIQUE constraint ensures that all values in a column (or a set of columns) are
unique. It allows NULL values
Default Constraint: The DEFAULT constraint allows you to specify a default value for a column. If no
value is provided during an insertion, the default value is used
Joins
In SQL, a join is used to combine rows from two or more tables based on a related column between them.
Joins are fundamental for querying data from multiple tables in a relational database. There are several
types of joins, each serving a different purpose. Here are the common types of joins along with their
syntax:
1. INNER JOIN: Returns only the rows where there is a match in both tables based on the specified
condition.
Syntax:
SELECT columns
FROM table1
2. LEFT JOIN: Returns all rows from the left table (table1) and the matched rows from the right table
(table2). If there is no match, NULL values are returned for columns from the right table.
Syntax:
SELECT columns
FROM table1
3. RIGHT JOIN: Returns all rows from the right table (table2) and the matched rows from the left table
(table1). If there is no match, NULL values are returned for columns from the left table.
Syntax:
SELECT columns
FROM table1
RIGHT JOIN table2 ON table1.column = table2.column;
4. FULL JOIN: Returns all rows when there is a match in either the left or right table. If there is no
match, NULL values are returned for columns from the table without a match.
Syntax:
SELECT columns
FROM table1