Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 29

Introduction to Databases

Mr. Joseph F. A. Tellewoyan, Jr

Sensitivity: Public
Concept of Databases
To understand Database Management Systems, first we need a data.
What is a Data? It is a fact recorded in the form of text, number, image, movie, etc.
A database is also collection of information stored in an organized form
in a computer. A database program is a software tool for organizing storage and retrieval of that information.

A database is...
 A database is a collection of data.
 An information manager.
 Databases make it possible to store, organize and retrieve information in ways that otherwise would not be possible.
 Databases come in all sizes and shapes from mainframe applications that run multinational corporations to appointment calendars in PDAs.
 Just about any collection of information can be turned into a database.

Sensitivity: Public
Concept of Database
Benefits of a Database

 Databases make it easy to store large quantities of information. The larger the mass of information, the bigger the benefit of using a database.
 Databases make it easy to retrieve information quickly and flexibly.
 Databases make it easy to organize and reorganize information. You can quickly switch between schemes.
 Databases make it easy to print and distribute information in a variety of ways.
 Databases have a specialized vocabulary.

So, Database is a collection of interrelated data which helps in the efficient retrieval, insertion, and deletion of data from the database and organizes
the data in the form of tables, views, schemas, reports, etc. For Example, a university database organizes the data about students, faculty, admin staff,
etc. which helps in the efficient retrieval, insertion, and deletion of data from it.

Sensitivity: Public
Concept of Database
A Database Management System (DBMS) is a software system that is designed to manage and organize data in a structured manner. It allows users to create, modify, and query a
database, as well as manage the security and access controls for that database. It is a computerized Record Keeping system.
Some key features of a DBMS include:

 Data modeling: A DBMS provides tools for creating and modifying data models, which define the structure and relationships of the data in a databas
 Data storage and retrieval: A DBMS is responsible for storing and retrieving data from the database and can provide various methods for searching and querying the data.
 Concurrency control: A DBMS provides mechanisms for controlling concurrent access to the database, to ensure that multiple users can access the data without conflicting with
each other.
 Data integrity and security: A DBMS provides tools for enforcing data integrity and security constraints, such as constraints on the values of data and access controls that
restrict who can access the data.
 Backup and recovery: A DBMS provides mechanisms for backing up and recovering the data in the event of a system failure.

DBMS can be classified into two types: Relational Database Management System (RDBMS) and Non-Relational Database Management System (NoSQL or Non-SQL)

RDBMS: Data is organized in the form of tables and each table has a set of rows and columns. The data is related to each other through primary and foreign keys.
NoSQL: Data is organized in the form of key-value pairs, document, graph, or column-based. These are designed to handle large-scale, high-performance scenarios.

Database Management System: The software which is used to manage databases is called Database Management System (DBMS). For Example, MySQL, Oracle, etc. are popular
commercial DBMS used in different applications. DBMS allows users the following tasks:
• Data Definition: It helps in the creation, modification, and removal of definitions that define the organization of data in the database.
• Data Updation: It helps in the insertion, modification, and deletion of the actual data in the database.
• Data Retrieval: It helps in the retrieval of data from the database which can be used by applications for various purposes.
• User Administration: It helps in registering and monitoring users, enforcing data security, monitoring performance, maintaining data integrity, dealing with concurrency control,
and recovering information corrupted by unexpected failure.

Sensitivity: Public
Concept of Database
There are four types of Data Languages:

1. Data Definition Language (DDL)


2. Data Manipulation Language(DML)
3. Data Control Language(DCL)
4. Transactional Control Language(TCL)
DDL is the short name for Data Definition Language, which deals with database schemas and descriptions, of how the data should reside in the database.
 CREATE: to create a database and its objects like (table, index, views, store procedure, function, and triggers)
 ALTER: alters the structure of the existing database
 DROP: delete objects from the database
 TRUNCATE: remove all records from a table, including all spaces allocated for the records are removed
 COMMENT: add comments to the data dictionary
 RENAME: rename an object

DML is the short name for Data Manipulation Language which deals with data manipulation and includes most common SQL statements such SELECT, INSERT, UPDATE, DELETE,
etc., and it is used to store, modify, retrieve, delete and update data in a database.

• SELECT: retrieve data from a database


• INSERT: insert data into a table
• UPDATE: updates existing data within a table
• DELETE: Delete all records from a database table
• MERGE: UPSERT operation (insert or update)
• CALL: call a PL/SQL or Java subprogram
• EXPLAIN PLAN: interpretation of the data access path
• LOCK TABLE: concurrency Control

Sensitivity: Public
Concept of Database
DCL is short for Data Control Language which acts as an access specifier to the database.(basically to grant and revoke permissions to users in the
database:

 GRANT: grant permissions to the user for running DML(SELECT, INSERT, DELETE,…) commands on the table
 REVOKE: revoke permissions to the user for running DML(SELECT, INSERT, DELETE,…) command on the specified table

TCL is short for Transactional Control Language which acts as a manager for all types of transactional data and all transactions. Some of the command
of TCL are:

 Roll Back: Used to cancel or Undo changes made in the database


 Commit: It is used to apply or save changes in the database
 Save Point: It is used to save the data on the temporary basis in the database

Sensitivity: Public
Concept of Database
When it comes to choosing a database, the biggest decisions is picking a relational (SQL) or non-relational (NoSQL) data structure. While both the databases are viable options still there are certain
key differences between the two that users must keep in mind when deciding.
The Main Differences:
1. Type – SQL databases are primarily called as Relational Databases (RDBMS); whereas NoSQL database are primarily called as non-relational or distributed database.

2. Language – SQL databases defines and manipulates data based structured query language (SQL). Seeing from a side this language is extremely powerful. SQL is one of the most versatile and
widely-used options available which makes it a safe choice especially for great complex queries. But from other side it can be restrictive. SQL requires you to use predefined schemas to
determine the structure of your data before you work with it. Also, all your data must follow the same structure. This can require significant up-front preparation which means that a change in the
structure would be both difficult and disruptive to your whole system.
A NoSQL database has dynamic schema for unstructured data. Data is stored in many ways which means it can be document-oriented, column-oriented, graph-based or organized as a KeyValue
store. This flexibility means that documents can be created without having defined structure first. Also, each document can have its own unique structure. The syntax varies from database to
database, and you can add fields as you go.

3. Scalability – In almost all situations SQL databases are vertically scalable. This means that you can increase the load on a single server by increasing things like RAM, CPU or SSD. But on the
other hand, NoSQL databases are horizontally scalable. This means that you handle more traffic by sharding or adding more servers in your NoSQL database. It is similar to adding more floors
to the same building versus adding more buildings to the neighborhood. Thus, NoSQL can ultimately become larger and more powerful, making these databases the preferred choice for large or
ever-changing data sets.

4. Structure – SQL databases are table-based on the other hand NoSQL databases are either key-value pairs, document-based, graph databases or wide-column stores. This makes relational SQL
databases a better option for applications that require multi-row transactions such as an accounting system or for legacy systems that were built for a relational structure.

5. Property followed – SQL databases follow ACID properties (Atomicity, Consistency, Isolation and Durability) whereas the NoSQL database follows the Brewers CAP theorem (Consistency,
Availability and Partition tolerance).

6. Support – Great support is available for all SQL database from their vendors. Also, a lot of independent consultations are there who can help you with SQL database for a very large-scale
deployments but for some NoSQL database you still have to rely on community support and only limited outside experts are available for setting up and deploying your large-scale NoSQL
deployments.

Sensitivity: Public
Understanding ER Models in Databases
ER Model is used to model the logical view of the system from a data perspective which consists of these components:

Entity, Entity Type, Entity Set –


An Entity may be an object with a physical existence – a particular person, car, house, or employee – or it may be an object with a conceptual
existence – a company, a job, or a university course.
An Entity is an object of Entity Type, and a set of all entities is called as an entity set. e.g.; E1 is an entity having Entity Type Student and set of all
students is called Entity Set. In ER diagram, Entity Type is represented as:

Sensitivity: Public
Understanding ER Models in Databases
Attribute(s):
Attributes are the properties that define the entity type. For example, Roll_No, Name, DOB, Age, Address, Mobile_No are the attributes that define entity type Student. In ER diagram,
the attribute is represented by an oval.

Kinds of Attribute:
 Key Attribute –
The attribute which uniquely identifies each entity in the entity set is called key attribute.For example, Roll_No will be unique for each student. In ER diagram, key attribute is
represented by an oval with underlying lines.

 Composite Attribute –
An attribute composed of many other attribute is called as composite attribute. For example, Address attribute of student Entity type consists of Street, City, State, and Country. In
ER diagram, composite attribute is represented by an oval comprising of ovals.

Sensitivity: Public
Understanding ER Models in Databases
 Multivalued Attribute –
An attribute consisting more than one value for a given entity. For example, Phone_No (can be more than one for a given student). In ER diagram, a
multivalued attribute is represented by a double oval.

 Derived Attribute –
An attribute that can be derived from other attributes of the entity type is known as a derived attribute. e.g.; Age (can be derived from DOB). In ER
diagram, the derived attribute is represented by a dashed oval.

Sensitivity: Public
Understanding ER Models in Databases
Relationship Type and Relationship Set: A relationship type represents the association between entity types. For example, 'Enrolled in’ is a relationship type
that exists between entity type Student and Course. In ER diagram, the relationship type is represented by a diamond and connecting the entities with lines.

A set of relationships of the same type is known as a relationship set. The following relationship set depicts S1 as enrolled in C2, S2 is enrolled in C1, and
S3 is enrolled in C3.

Sensitivity: Public
Understanding ER Models in Databases
Degree of a relationship set:
The number of different entity sets participating in a relationship set is called as the degree of a relationship set.
1. Unary Relationship – When there is only ONE entity set participating in a relation, the relationship is called a unary relationship. For example, one person is married to only one person.
2. Binary Relationship – When there are TWO entities set participating in a relationship, the relationship is called a binary relationship. For example, a Student is enrolled in a Course.
3. N-ary Relationship – When there are n entities set participating in a relation, the relationship is called an an n-ary relationship.
Cardinality:
The number of times an entity of an entity set participates in a relationship set is known as cardinality. Cardinality can be of different types:
3. One-to-one – When each entity in each entity set can take part only once in the relationship, the cardinality is one-to-one. Let us assume that a male can marry one female and a female can marry one
male. So, the relationship will be one-to-one.

4. Many to one – When entities in one entity set can take part only once in the relationship set and entities in other entity sets can take part more than once in the relationship set, cardinality is
many to one. Let us assume that a student can take only one course, but one course can be taken by many students. So, the cardinality will be n to 1. It means that for one course there can be n students
but for one student, there will be only one course.

5. Many to many – When entities in all entity sets can take part more than once in the relationship cardinality is many to many. Let us assume that a student can take more than one course and one
course can be taken by many students. So, the relationship will be many to many.

Sensitivity: Public
Understanding ER Models in Databases
3. Many to many – When entities in all entity sets can take part more than once in the relationship cardinality is many to many. Let us assume that a
student can take more than one course and one course can be taken by many students. So the relationship will be many to many.

Sensitivity: Public
SQL Server
What is SQL?
SQL is a short-form of the structured query language, and it is pronounced as S-Q-L or sometimes as See-Quell.
This database language is mainly designed for maintaining the data in relational database management systems. It is a special tool used by data professionals for handling structured data (data which
is stored in the form of tables). It is also designed for stream processing in RDSMS.
You can easily create and manipulate the database, access and modify the table rows and columns, etc. This query language became the standard of ANSI in the year of 1986 and ISO in the year of
1987.

Big enterprises like Facebook, Instagram, and LinkedIn, use SQL for storing the data in the back-end.

History of SQL
"A Relational Model of Data for Large Shared Data Banks" was a paper which was published by the great computer scientist "E.F. Codd" in 1970.

The IBM researchers Raymond Boyce and Donald Chamberlin originally developed the SEQUEL (Structured English Query Language) after learning from the paper given by E.F. Codd. They both
developed the SQL at the San Jose Research laboratory of IBM Corporation in 1970.
At the end of the 1970s, relational software Inc. developed their own first SQL using the concepts of E.F. Codd, Raymond Boyce, and Donald Chamberlin. This SQL was totally based on RDBMS.
Relational Software Inc., which is now known as Oracle Corporation, introduced the Oracle V2 in June 1979, which is the first implementation of SQL language. This Oracle V2 version operates on
VAX computers.

Database Engine
It is the core of the SQL Server architecture. It is the second layer of the architecture that provides connectivity between user connections using network protocol and SQL server operating system to perform
actual execution. It shows the logical architectures of the database objects such as tables, views, stored procedures, and triggers that work with physical architecture and relation engine to fulfill client requests.
The Database Engine consists of two parts:
Relational Engine: It is responsible for evaluating user requests and performs execution. It decides the most efficient way to run a query. It is also named the query processor. Query processing, memory
management, thread and task management, buffer management, and distributed query processing are all main tasks performed by this engine.
Storage Engine: It shows the physical database architecture, as well as data storage and retrieval from storage systems and the buffer manager.

Sensitivity: Public
SQL Server
Usage of SQL Server
The following are the key usage of MS SQL Server:
 Its main purpose is to build and maintain databases.
 It is used to analyze the data using SQL Server Analysis Services (SSAS).
 It is used to generate reports using SQL Server Reporting Services (SSRS).
 It is used to perform ETL operations using SQL Server Integration Services (SSIS).

SQL Server Editions


SQL Server comprises five editions with different bundled services and tools and pricing options to meet the user needs. Microsoft provides two editions of SQL Server free of charge, which are
given below:

SQL Server Developer: This edition was released mainly for use in the non-production environment, i.e., database development and testing. It allows to build, test, and demo purpose.

SQL Server Express: It is used for small-scale applications and databases with disc storage capacities of up to 10 GB.

For commercial purposes, the following editions are used:

SQL Server Enterprise: It is used in high-end, larger, and more critical businesses. All SQL Server features, such as high-end security, advanced analytics, and machine learning, are included in this
version.

SQL Server Standard: This edition is suitable for data marts and mid-tier applications that included basic reporting and analytics. It supports partial enterprise edition's feature, as well as server
limitations on the number of processor cores and memory that we can configure.

SQL Server WEB: This edition is suitable for Web-hosters who want a low overall ownership cost. It has features of scalability, manageability capabilities, and affordability for small to large-scale
web properties.

Sensitivity: Public
SQL Server – DATA Types
A datatype ensures which type of data our column or variable can store in SQL Server. When we create any table or variable, it is required to specify the type of data it will store in addition to the
name of each column. For example, in SQL Server, each table has many columns and contains specific data types for each column that should be integer, float, varchar, Boolean, etc.

How to use Datatypes:

One is required to specify the data type in advance for each column of a table to ensure which type of data it can store. The data type specification also prevents the user from entering any unexpected
or invalid information.
When you assign the appropriate data type to a column, we can make efficient use of memory by allocating only the amount of system memory required for the data in the relevant column.

We can use the following characteristics to define data type in SQL Server:
 The type of values (fixed or variable) it represents.
 The storage space depends on the values, which are a fixed-length or variable length.
 Its storage value can be indexed or not.
 How SQL Server performs a comparison of values of a particular data type.

SQL Server supports a broad category of SQL standard data types based on the user's needs. These data types can be broken into the following categories:
 Exact numeric
 Approximate numeric
 Date and time
 Character strings
 Unicode character strings
 Binary strings
 Other data types

Sensitivity: Public
SQL Server – DATA Types
Exact numeric data type
This data type will store exact numbers such as integer, decimal, and money. They have their own lower, upper limit, and memory requirements. They have their own memory needs, as well as a
lower and upper limit. It is also necessary to use the lowest data type to save memory requirements. For example, the bit data type can be used to store true (1) or false (0) values. SQL Server
categorizes this data type into nine types, which are given below:

Data Type Descriptions


bit It is an integer type that allows us to store 0, 1, and NULL values.
tinyint It allows us to store whole numbers from 0 to 255.
smallint It allows us to store whole numbers between -32768 to 32767.
int It allows to store whole numbers between -2,147,483,648 and 2,147,483,647
bigint It allows to store whole numbers between -9,223,372,036,854,775,808 and 9,223,372,036,854,775,807
Decimal(p, s) It is used for scale and fixed precision numbers.
The p parameter indicates the maximum total number of digits that can be stored (both to the left and the right of the
decimal point). By default, it is 18 but can be in a range of 1 to 38.
The s parameter indicates the maximum number of digits stored to the right of the decimal point. By default, its value
is 0 but can be from 0 to p.
Numeric(p, s) It is similar to the decimal data type because both are synonyms.
smallmoney It allows storing monetary or currency values.
money It allows to store monetary or currency values.

Character string data type


This data type allows us to define the character data type only, which can be fixed or variable in length. The following table illustrates all character string data type support in SQL Server:

Sensitivity: Public
SQL Server – DATA Types
Character string data type
This data type allows us to define the character data type only, which can be fixed or variable in length. The following table illustrates all character string data type support in SQL Server:

Data Type Descriptions Lower Range Upper Range Storage

char(n) It is used to store fixed-length non-Unicode character data. 0 characters 8000 characters n bytes

varchar(n) It is used to store variable-length non-Unicode character data. 0 characters 8000 characters n bytes + 2 bytes

It is a data type that stores variable-length data. It is


recommended to avoid this data type unless required because
varchar(max) of its huge memory storage. 0 characters 2^31 characters n bytes + 2 bytes

It is a variable-length character string. It is also recommended


to avoid this data type because it would be deprecated in 2,147,483,647
text future releases. 0 characters chars n bytes + 4

Sensitivity: Public
SQL Server
SQL Server provides two types of database:
System databases
User Databases
System Databases: The system databases are created automatically while installing the MS SQL Server on our system. It plays an essential role in the server such database run perfectly. The following are
the list of system databases in SQL Server:
Master
Model
MSDB
Tempdb

User Databases: The user databases are created by database users like DBAs and testers who can access a database also.

We can create a database in SQL Server mainly in two ways:


Transact-SQL Command
SQL Server Management Studio

CREATE DATABASE using T-SQL Command


The below syntax enables the users to create a new database in SQL Server:

SYNTAX:
Syntax -tells the computer how to read the code. Syntax refers to a concept in writing code dealing with a very specific set of words and a very specific order to those words when we give the computer
instructions.

Create DATABASE database_name;

Sensitivity: Public
SQL Server
In the SQL database for creating a table, use a command called CREATE TABLE.

SQL CREATE TABLE Statement


A Table is a combination of rows and columns. For creating a table, one must define the structure of a table by adding names to columns and providing data type and size of data to be stored in columns.

Syntax:

CREATE table table_name


(
Column1 datatype (size),
column2 datatype (size),
columnN datatype(size)
);

Here table_name is name of the table, column is the name of column

Add multiple columns in table


You can use the ALTER TABLE statement in SQL Server to add multiple columns to a table.

Syntax
The syntax to add multiple columns to an existing table in SQL Server (Transact-SQL) is:

ALTER TABLE table_name


ADD column_1 column_definition,
column_2 column_definition,
...
column_n column_definition;

Sensitivity: Public
SQL Server
SQL constraints are used to specify rules for the data in a table.

Constraints are used to limit the type of data that can go into a table. This ensures the accuracy and reliability of the data in the table. If there is any violation between the constraint and the data action, the action is aborted.

Constraints can be column level or table level. Column level constraints apply to a column, and table level constraints apply to the whole table.

The following constraints are commonly used in SQL:

NOT NULL - Ensures that a column cannot have a NULL value


By default, a column can hold NULL values.
The NOT NULL constraint enforces a column to NOT accept NULL values.

This enforces a field to always contain a value, which means that you cannot insert a new record, or update a record without adding a value to this field.

UNIQUE - Ensures that all values in a column are different. The UNIQUE constraint ensures that all values in a column are different.
Both the UNIQUE and PRIMARY KEY constraints provide a guarantee for uniqueness for a column or set of columns.
A PRIMARY KEY constraint automatically has a UNIQUE constraint. However, you can have many UNIQUE constraints per table, but only one PRIMARY KEY constraint per table.

PRIMARY KEY - A combination of a NOT NULL and UNIQUE. Uniquely identifies each row in a table
The PRIMARY KEY constraint uniquely identifies each record in a table. Primary keys must contain UNIQUE values and cannot contain NULL values.
A table can have only ONE primary key; and in the table, this primary key can consist of single or multiple columns (fields).

FOREIGN KEY - Prevents actions that would destroy links between tables
The FOREIGN KEY constraint is used to prevent actions that would destroy links between tables. FOREIGN KEY is a field (or collection of fields) in one table, that refers to the PRIMARY KEY in another table.
The table with the foreign key is called the child table, and the table with the primary key is called the referenced or parent table.

Sensitivity: Public
SQL Server
CHECK - Ensures that the values in a column satisfies a specific condition
The CHECK constraint is used to limit the value range that can be placed in a column. If you define a CHECK constraint on a column, it
will allow only certain values for this column.
If you define a CHECK constraint on a table, it can limit the values in certain columns based on values in other columns in the row.

DEFAULT - Sets a default value for a column if no value is specified


The DEFAULT constraint is used to set a default value for a column.
The default value will be added to all new records, if no other value is specified.

IDENTITY(1, 1) -> is also a property of the column telling us that this value shall be generated automatically, starting from 1 and
increasing by 1 for each new record

Sensitivity: Public
SQL Server
SQL clauses are divided into several types, each with a different role.

SELECT – Selects the records from the table


WHERE – Filters out unwanted records that don't meet certain conditions

ORDER BY – Orders the resultset by one or more columns in ascending order (ASC) or descending order (DESC).

WHERE Clause
The WHERE clause in SQL defines the condition to extract and display only those records that fulfill the given situation.

Syntax
SELECT column_name(s) FROM table_name WHERE condition

The ORDER BY clause defines the order of the query output in ascending (ASC) or descending (DESC) order. Ascending (ASC) is the default, but descending (DESC) is set explicitly.

Syntax

SELECT column_name(s) FROM table_name WHERE condition ORDER BY column_name ASC|DESC

Sensitivity: Public
SQL Server
Operators are symbols specifying an action that is performed on one or more expressions.
Arithmetic operators run mathematical operations on two expressions of one or more data types. They're run from the numeric data type category.

Operator Meaning
+ (Add) Addition
- (Subtract) Subtraction
* (Multiply) Multiplication
/ (Divide) Division
% (Modulo) Returns the integer remainder of a division. For example, 12 % 5 = 2 because the remainder of 12 divided by 5 is 2.

Comparison operators test whether two expressions are the same. Comparison operators can be used on all expressions except expressions of the text, ntext, or image data types.
Operator Meaning
= (Equals) Equal to
> (Greater Than) Greater than
< (Less Than) Less than
>= (Greater Than or Equal To) Greater than or equal to
<= (Less Than or Equal To) Less than or equal to
<> (Not Equal To) Not equal to
!= (Not Equal To) Not equal to (not ISO standard)
!< (Not Less Than) Not less than (not ISO standard)
!> (Not Greater Than) Not greater than (not ISO standard)

Sensitivity: Public
SQL Server
WHERE keyword is used for fetching filtered data in a result set. It is used to fetch data according to particular criteria. WHERE keyword can also be used to filter data by matching
patterns.

Syntax:

SELECT column1,column2 FROM table_name WHERE column_name operator value;

Operator Description
> Greater Than
>= Greater than or Equal to
< Less Than
<= Less than or Equal to
= Equal to
<> Not Equal to
AND
OR
LIKE Search for a pattern
IN To specify multiple possible values for a column

Sensitivity: Public
SQL Server
A wildcard character can be used to substitute for any other character(s) in a string.

SQL Wildcard Characters


In SQL, wildcard characters are used with the SQL LIKE operator.

SQL wildcards are used to search for data within a table.


%
‘A%’ – Searching a word beginning with A
‘%A’ – Searching a word ending with A
‘%A%’ – Searching a word that contains A

[charlist]

[ABC]% - searching words beginning with A,B or C


[!ABC]%- Searching words not beginning with A,B or C

Sensitivity: Public
SQL Server
Aliases: SQL aliases are used to give a table, or a column in a table, a temporary name. Aliases are often used to make column names more readable.
An alias only exists for the duration of that query. An alias is created optionally with the AS keyword.

Joins
In a relational database, data is distributed in multiple logical tables. To get a complete meaningful set of data, you need to query data from these tables using joins. SQL Server
supports many kinds of joins. They include:
Inner join, Left join, Right join, full outer join, and cross join.
Each join type specifies how SQL Server uses data from one table to select rows in another table.
Inner join produces a data set that includes rows from the left table, matching rows from the right table.

Left join selects data starting from the left table and matching rows in the right table. The left join returns all rows from the left table and the matching rows from the right table. If a
row in the left table does not have a matching row in the right table, the columns of the right table will have nulls.

The left join is also known as the left outer join. The outer keyword is optional.

Sensitivity: Public
SQL Server
The right join or right outer join selects data starting from the right table. It is a reversed version of the left join.

The right join returns a result set that contains all rows from the right table and the matching rows in the left table. If a row in the right table does not have a matching row in the left
table, all columns in the left table will contain nulls.

Sensitivity: Public
SQL Server
UPDATE STATEMENT

In order to modify data in a table, use an Update statement, a DML (data manipulation language) statement. A SQL update statement comes with a SET
clause where we define the column-and-value as a pair of items. In addition, you can enforce the conditional clause. In order to limit the number of rows,
there is a need to set up a where clause. The condition is defined in the where clause that identifies what rows to modify in the table.

Update Tablename
set column = value
Where condition column = value

The GROUP BY Statement in SQL is used to arrange identical data into groups with the help of some functions. i.e. if a particular column has the same
values in different rows then it will arrange these rows in a group.

Features
GROUP BY clause is used with the SELECT statement.
In the query, the GROUP BY clause is placed after the WHERE clause.
In the query, the GROUP BY clause is placed before the ORDER BY clause if used.

Sensitivity: Public

You might also like