0% found this document useful (0 votes)
47 views43 pages

Myprac

Uploaded by

mayankthakur096
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views43 pages

Myprac

Uploaded by

mayankthakur096
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 43

Directorate of Distance Education,

Kurukshetra University, Kurukshetra

Practical File

PGDCA (July 2023)

Subject:- MS-Word, Excel, SQL(CS-DE-17)

Submitted By:-

Name:- Mayank
Ref. No.:- 232DCAP1/000060
Table of Contents

S. No. Contents Pages


MS-WORD:- 1
1. Create a document by using different editing and 2
formatting options
2. Design a greeting card for different festivals 4
3. Create your bio-data or resume 6
4. Applying header and footer in document 7
5. Implement mail merge 9
EXCEL:-
6. Calculate the total cost of party 11
7. Calculate percentage and grade of students 13
8. Calculate Income Tax, Surcharge, Total Tax 15
9. Construct 3D Pie Chart, 2D Line Chart, 2D Column 17
Chart
10. Obtain the solution for the cost price so that the profit 20
will be 20000
SQL:-
11. Use Oracle software and practice basic commands 23
12. Create table, insert and display values 26
13. Modify and delete records from the table 28
14. Implement constraints in SQL 31
15. Add, delete, and modify columns in table using ALTER 38
TABLE
16. Implement where, order by, group by, having clause, 41
and aggregate functions
17. Use set operations to query the tables 43
18. Create joins and views on tables 44
19. Search for specific pattern using LIKE operator 45
20. Generate sub-queries in SQL 48
MS-WORD
Experiment-1
Create a document by using different editing and formatting options.
Steps:-
1) Open Microsoft Word
a) Lauch Microsoft word by clicking on its icon or searching for it in
your computer’s applications.
2) Create a New Document
a) Click on “File” in the upper-left corner.
b) Select “New” to create a new document.
c) Choose a blank document template.
3) Enter Text:
a) Start typing your content into the blank document.
4) Basic Editing:
a) Use standard editing tools like Cut(Ctrl+X), Copy(Ctrl+C), and Paste
(Ctrl+V) to move and duplicate text.
5) Formatting Text:
a) Highlight the text you want to format.
b) Use the formatting options on the “Home” tab:
i) Font: Change font type, size, color and style (bold, italic,
underline).
ii) Paragraph: Adjust alignment, line spacing, indentation and
bullet/numbered lists.
iii) Styles: Apply predefined styles to text (Heading 1,Heading 2,
etc.).
iv) Clear Formatting: Remove any applied formatting.
6) Applying Styles
a) Use styles to quickly format headings, subheadings, and other content
consistently.
b) Access styles from the “Styles” group on the “Home” tab.
7) Inserting Elements:
a) Use the “Insert” tab to add various elements:
i) Pictures: Insert images from your computer.
ii) Shapes: Add shapes for emphasis or diagrams.
iii) SmarArt: Create visual representations of processes or
hierarchies.
iv) Tables: Insert tables for data organization.
v) Hyperlinks: Add links to web pages or other documents.
vi) Headers and Footers: Add consistent header/footer content.
8) Page Layout:
a) Use the “Page Layout” tab to adjust document layout and design:
i) Margins: Set the page margins.
ii) Orientation: Choose between portrait and landscape modes.
iii) Page Size: Change the size of the paper.
iv) Columns: Divide text into columns.
9) Editing Features:
a) Utilize features for advanced editing and enhancing readability:
i) Find and Replace: Search for specific words and replace them.
ii) Spell check and Grammar: Use built in proofreading tools.
iii) Thesaurus: Find synonyms for words.
10) Page Numbers:
a) Add page numbers via the “Insert” tab to help organize your
document.
11) Headers and Footers:
a) Insert headers and footers to display consistent content at the top and
bottom of each page.
12) Table of Contents (Optional):
a) If your document is lengthy, consider adding a table of contents using
the “References” tab.
13) Save Your Document:
a) Click “File” and choose “Save As” to save your document to a
location on your computer.
14) File Formatting:
a) Use the “Save As” dialog to choose a file format (e.g., .docx or .pdf)
based on your needs.
15) Final Review:
a) Proofread your document of errors, formatting issues, and consistency.
16) Print or Share:
a) Print your document or share it electronically as needed.
Apply:-

Do Not Go Gentle Into That Good Night

Do not go gentle into that good night,


Old age should burn and rave at close of day;
Rage, rage against the dying of the light.

Though wise men at their end know dark is right,


Because their words had forked no lightning they
Do not go gentle into that good night.

Good men, the last wave by, crying how bright


Their frail deeds might have danced in a green bay,
Rage, rage against the dying of the light.

Wild men who caught and sang the sun in flight,


And learn, too late, they grieve it on its way,
Do not go gentle into that good night.

Grave men, near death, who see with blinding sight


Blind eyes could blaze like meteors and be gay,
Rage, rage against the dying of the light.

And you, my father, there on the sad height,


Curse, bless, me now with your fierce tears, I pray.
Do not go gentle into that good night.
Rage, rage against the dying of the light.
Experiment 2

Design a greeting card for different festivals.

Steps:-
1) Open Microsoft Word:
a) Launch Microsoft word by clicking on its icon or searching for it in
your computer’s applications.
2) Create a New Document:
a) Click on “File” in the upper-left corner.
b) Select “New” to create a new document.
c) Choose a blank document template.
3) Page Layout:
a) Use the “Page Layout” tab to set the card’s size:
i) Click on “Size” to choose a specific size (e.g., 5x7 inches) for
your greeting card.
ii) Adjust the orientation (portrait/landscape) as needed.
4) Background Color or Image:
a) Use the “Design” tab to set a background color or image for the card:
i) Click on “Page Color” to choose a background color.
ii) To use an image, go to “Page Color”>”Fill Effects”> “Picture”.
5) Insert Images:
a) Use the “Insert” tab to add festive images:
i) Click “Pictures” to insert images from your computer.
ii) You can also use “Online Pictures” to search for relevant
images.
6) Text:
a) Use the “Insert” tab to add text:
i) Choose “Text Box” to create a text box for your message.
ii) Type your festive greeting inside the text box.
iii) Format the text using the “Font” options on the “Home” tab.
7) Shapes and Decorations:
a) Use the “Insert” tab to add shapes and decorative elements:
i) Click ”Shapes” to choose from a variety of shapes (e.g., hearts,
stars).
ii) Customize shapes by changing their colors and sizes.
8) Borders and Farmers:
a) Add borders or frames to your card:
i) Use the “Design” tab to apply a border to your card.
ii) Adjust the line style, color and thickness.
9) Clip Art and Icons:
a) Use the “Insert” tab to add clip art or icons:
i) Click “Icons” to search for and insert relevant icons.
ii) Customize their colors and sizes.
10) Text Effects:
a) Apply text effects to make your message stand out:
i) Highlight the text.
ii) Use the “Text Effects” options on the “Format” tab to add
effects like shadows, reflections, and more.
11) Saving your card:
a) Click “File”>”Save as” to save your greeting card to a location on
your computer.
b) Choose a name for your card and select a format (e.g., PDF or Word
Document) to save it in.
12) Printing or Sharing:
a) Print your greeting card on appropriate cardstock or paper.
b) Share it electronically by converting it to a PDF and sending it via
email or social media.
Insert clip art and icons:-

Practical of
Ms-word

TASK COMPLETED
Experiment-3
Create your bio-data or resume.

Steps:-
1) Create a New Document:
a) Click on “File” in the upper-left corner.
b) Select “New” to create a new document.
c) Choose a blank document template.
2) Choose a Resume Template:
a) Browse the available templates in the “New Document” doalog.
b) Search for “resume” to find relevant templates.
c) Choose a template that matches your style and profession.
3) Enter Your Contact Information:
a) In the template, replace the placeholder text with your name, address,
phone number, and email.
4) Write your professional summary/objective:
a) Include a brief paragraph that summarizes your skills, experience and
goals.
b) Place this under your contact information.
5) List Your Work Experience:
a) Include your job history in reverse chronological order (most recent
first).
b) For each position, include your job title, company name, location,
dates worked, and a brief description of your responsibilities and
accomplishments.
6) Add Your Education:
a) List your educational background in reverse chronological order.
b) Include the name of the institution, degree earned, field of study, and
graduation date.
7) Highlight Skills:
a) Create a section for your skills, including technical skills, languages,
and relevant certifications.
b) You can organize skills in bullet points or columns.
8) Include Additional Sections (Optional):
a) Depending on your industry and background, you might want to
include sections such as:
i) Projects
ii) Achievements
iii) Volunteer Work
iv) Publications
v) Awards
9) Formatting and Styling:
a) Format your resume for clarity and readability:
i) Use headings and subheadings for different sections.
ii) Utilize bullet points for listing responsibilities and
achievements.
iii) Maintain consistent font styles and sizes.
10) Add Keywords (Optional):
a) If submitting your resume online or through applicant tacking
systems, consider adding relevant keywords related to your field.
BIO DATA

Name : Nisha Rani

Mobile : 8054305353

Email id : ynisha243@gmail.com

Husband Name : Sandeep Kumar

Gender : Female

Date of Birth : 13.07.1992

Marital Status : Married

Religion : Hindu

Languages Known : Hindi, English

Qualification

Classes Institute Name Year of Passing Marks Percentage


10th Hindu Sr. Sec. School, Hansi 2009 65%
12th Hindu Sr. Sec. School, Hansi 2011 79%
Graduation N.M. College 2014 62%

Experience

S No Company Name Position Working Period


1 N.M.Y. International JSS Feb.2017 - Aug.2019
2 A & FW Dep. SSS Sep. 2019 – Till date

Address: E-10, Kandi Complex, Sector-21, Panchkula.

Place : Panchkula.

Date : 22.02.2024

Signature
Experiment-4
Applying header and footer in document.

Steps:-

1) Create or Open a document:


a) Create a new document or open an existing one that you want to add
headers and footers to.
2) Access Header and Footer Area:
a) Click on the “Insert” tab in the ribbon at the top of the window.
3) Insert Header:
a) In the “Header & Footer” group, click on “Header.”
b) A dropdown menu will appear with various header styles.
c) Choose a desired header style, such as “Blank”, “Simple”, or a
predefined template.
4) Insert Footer:
a) Similarly, click on “footer” in the “Header & Footer” group.
b) Choose a footer style, similar to the header styles.
5) Edit Header and Footer:
a) After inserting the header or footer, you’ll be taken to the
header/footer are of your document.
b) You can enter text, insert images, add page numbers, and apply
formatting just like you would in the main document area.
c) Use the tools and options in the “Header & Footer Tools” tab that
appears when you’re working in the header/footer area.
6) Adding Page Numbers:
a) To add page numbers to your header or footer:
i) Click on the “Insert Page Number” button in the “Header &
Footer Tools” tab.
ii) Choose where you want the page number to appear (left, center,
right) and select a format.
7) Inserting Date and Time:
a) You can also insert the date and time into your header or footer using
the “Insert Date” and “Insert Time” buttons in the “Header & Footer
Tools” tab.
8) Design Options:
a) Use the “Header & Footer Tools” tab to access design options:
i) Change header/footer style, color, font and alignment.
ii) Apply different headers/footers to odd and even pages.
iii) Link headers/footers to previous sections if you have multiple
sections in your document.
9) Exiting Header And Footer Area:
a) To exit the header/footer area and return to your main document,
double-click outside the header/footer or click the “Close Header and
Footer” button in the “Header & Footer Tools” tab.
10) Save Your Document:
a) Make sure to save your document after adding headers and footers.
EXCEL
Experiment-1

Calculate the total cost of party.

Steps:-
1) Open the file Birthday1.xlsx on your network drive.
2) Make the main title in row 1 and the column headings in row 3 bold.
3) Format cells C5 to C9 and cells D5 to D11 to two decimal places.
4) In cell D10 create a thick top and bottom border.
5) In cell D5 enter a formula to calculate the total cost for catering (i.e. the
number x the cost).
6) Insert similar formula to calculate the total cost for the other items.
7) Enter a label Total in cell C10. Make it bold.
8) In cell D10 insert a formula to find the grand total.
9) In cell C11 enter a label per Child. Make it bold.
10) In cell D11 enter a formula to divide the grand total by 20.
11) Save the file as Birthday2.xlsx
Experiment-2

The worksheet contains Roll Nos. and marks in 5 subjects of different students.
Calculate the percentage and grade of each student.

Steps:-
1) Make the main title in row 1 and the column headings in row 3 bold.
2) Use the formula= SUM(B5:E5) in cell F5 to calculate the total marks of
student. Copy and paste the same formula to calculate total for other
students.
3) Format cells G5 to G9 to two decimal places.
4) Use the formula =F5/400*100 in cell G5 to calculate the percentage of
student. Copy and paste the same formula to calculate percentage for
other students.
5) In cell H5 enter a formula to calculate the grade of student using the
following logic:-
a) If percentage is between 0-39, grade= F
b) If percentage is between 30-59, grade= C
c) If percentage is between 60-79, grade = B
d) If percentage is 80 or above, grade = A
= IF(G5>=80, “A”, IF(G5>=60, “B”, If(G5>=30, “C”, “F”))).
6) Save the file as classroom_data.xlsx
Experiment-3
The worksheet contains Name & Taxable Income for 5 employees, Calculate
Income Tax, Surcharge and Total Tax for the following worksheet.

Income tax is calculated as follows:


Taxable Income Income Tax
First 1,50,000 Nil
Next 1,00,000 10%
Next 75,000 20%
Excess 30%
Surcharge is 3% on Income Tax if taxable income is above 5,00,000/-
Steps:-

1) To calculate Income Tax:


In cell C5 enter the formula
=IF(B4<150000,0, if(B4<=250000, (B4-150000)*10%, if(B4<=325000,
10000+(B4-250000)*20%, 25000+(B4-325000)*30%)))
and press enter key.
It shows income tax for the first employee. Drag the formula up to C9.
2) To calculate Surcharge:
In cell D4 enter the formula =if(B4<500000,0,C4*3%) and press enter
key, it shows Surcharge for the first employee. Drag the formula up to
D9.
3) To calculate Total tax:
In cell E4 enter the formula = C4+D4 and press enter key. It shows Total
Tax for the first employee. Drag the formula up to E9.
Experiment-4
A worksheet contains name and marks of 10 students in 3 different subjects.
Calculate Total Marks.
a) Construct 3D Pie Chart for Total Marks.
b) Construct 2D Line Chart for Maths and Biology.
c) Construct 2D Column Chart for the 3 subjects.

Steps:-

1) 3D Pie Chart for Total marks:


a) Select entire column of Total Marks i.e. E5:E14
b) Insert Tab-Chart group-Pie option-3D Pie Chart
c) 3D Pie diagram appears
d) Click at Chart tools-layout-Chart Title- Above the chart
e) It displays a box above the chart
f) Click inside the box and type the title as 3D Pie Chart for Total Marks.
g) Click on the Legend area, right click and click at select data.
h) Click on edit at horizontal axis labels
i) Select range as A5:A14 (Click and drag) and ok
j) Names of students will be displayed in the legend area
2) 2D Line Chart for Maths and Biology:
a) Select B3:B14 keep pressing Ctrl key & select D3:D14
b) Insert Tab-Chart group-line option-sub option 2D
c) 2D line chart appears
d) Click at chart tools-layout-chart title-above the chart
e) It displays a box above the chart.
f) Click inside the box and type the title as Line Chart for Maths and
Biology
g) Under layout menu of chart tools, select Axis title-sub option primary
horizontal axis- and position below the axis
h) Axis title box appears below the horizontal axis
i) Click inside the box and type the title as student names
j) Under layout menu of chart tools, select axis title-sub option primary
vertical axis- and position rotated
k) Axis title box appear at the vertical axis in rotated position
l) Click inside the box and type the title as marks
m) Click on labels at Horizontal axis, right click and select data labels
option
n) Click on edit at Horizontal axis labels
o) It asks for the range for Horizontal axis labels
p) Select the range as A5:A14
q) Names of students will be displayed in the Horizontal Axis area.

3) 2D Column Chart:
a) Select A3:D14
b) Insert Tab-Chart group-Column option-sub option 2D
c) 2D Column chart appears
d) Under layout menu of chart tools, select chart title, sub option above
the chart
e) It displays a box above the chart.
f) Click inside the box and type the title as Column Chart for subjects
g) Also specify the axis titles as explained above
h) Also specify the Horizontal axis labels as explained above
Experiment-5
For the following worksheet obtain the solution for the cost price so that the
profit will be 20000.

Steps:-

1) At D2 enter formula = C2-A2-B2


2) Click at D2
3) Click on Data---Data Tools group --- what if analysis Subgroup --- Goal
seek option
4) Goal seek dialogue box appears
5) Enter the following data at the Goal seek dialogue box:

Set Cell D2
To value 20000
By changing cell A2

6) It displays goal seek status as follows:


Goal seeking with cell D2
Found a solution Target value 20000
Current value 20000
7) It displays the output
SQL
Experiment 1
Use Oracle software and login with valid username and password. Explore its
GUI and practice some basic commands on it.

Steps:-

1) Search for Run SQL Command Line in the system. The SQL Command
Line terminal will open.
2) Type “connect” command and then enter the valid username and
password.
3) After successful connection, you can execute the SQL commands in the
terminal.
4) Create a sample table using the CREATE TABLE command and use
DESC table_name or DESCRIBE table_name to display the structure of
table.

Output:-
Experiment-2

Create table with different fields and data types, insert values inside the table,
display the values stored in the table.

1) CREATE TABLE:-
a) The CREATE TABLE statement is used to create a new table in the
database.
b) The column parameters specify the names of the columns of the table.
c) The datatype parameter specifies the type of data the column can hold
(e.g. varchar, integer, date, etc.).
d) Syntax:
CREATE TABLE table_name(
Column1 datatype,
Column2 datatype,
Column3 datatype,
......
);

Output:-
2) INSERT INTO:-
a) The INSERT INTO statement is used to insert new records in a table.
b) Syntax:
INSERT INTO table_name (column1, column2, column3, ...)
VALUES ( value1, value2, value3, ....);

Output:-

3) SELECT:-
a) The SELECT statement is used to select data from a database.
b) Syntax:
SELECT column1, column2, ....
From table_name;

Output:-

SELECT*FROM Persons;
Experiment-3

Modify and delete records from a table.


1) UPDATE:-
a) The UPDATE statement is used to modify the existing records in a
table.
b) Syntax:
UPDATE table_name
SET column1= value1, column2= value2,...
WHERE condition;
Output:-

2) DELETE:-
a) The DELETE statement is used to delete existing records in a table.
b) Syntax:
DELETE FROM table_name WHERE condition;
Output:-
Experiment-4

Implement different types of constraints using CREATE TABLE and ALTER


TABLE statements.

1) NOT NULL Constraint:-


a) The NOT NULL constraint enforces a column to NOT accept NULL
values.
b) 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.

Output:-

2) UNIQUE Constraint:-
a) The UNIQUE constraint ensures that all values in a column are
different.

Output:-
CHECK Constriant:-

a) The CHECK constraint is used to limit the value range that can be
placed in a column.
b) If you define a CHECK constraint on a column it will allow only
certain values for this column.
c) If you define a CHECK constraint on a table it can limit the values in
certain column based on values in other columns in the row.

Output:-

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

Output:-
4) PRIMARY KEY Constraint:-
a) The PRIMARY KEY constraint uniquely identifies each record in a
table.
b) Primary keys must contain UNIQUE values, and cannot contain
NULL values.
c) A table can have only One primary key; and in the table, this primary
key can consist of single or multiple columns(fields).

Output:-

5) FOREIGN KEY Constraint:-


a) The FOREIGN KEY constraint is used to prevent actions that would
destroy links between tables.
b) A FOREIGN KEY is a field (or collection of fields) in one table, that
refers to the PRIMARY KEY in another table.
c) 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.

Output :-
Experiment 5

Add, delete and modify columns in an existing table using ALTER TABLE
statement.

1) Add columns syntax:-


ALTER TABLE table_name
ADD column_name datatype;

Output:-

2) Drop column syntax:-


ALTER TABLE table_name
DROP COLUMN column_name;

Output:-
3) Alter/Modify data type of a column:-
ALTER TABLE table_name
MODIFY COLUMN column_name datatype;

Output:-
Experiment 6

Explore select statement using various clauses like where, order by, group by,
having and aggregate functions.

1) WHERE clause:-
a) The WHERE clause is used to filter records.
b) It is used to extract only those records that fulfil a specified
condition.
c) Syntax:
SELECT column1, column2,......
FROM table_name
WHERE condition;

Output:-

SELECT * FROM Persons WHERE PersonID = 12;

2) ORDER BY clause:-
a) The ORDER BY keyword is used to sort the result-set in ascending
or descending order.
b) The ORDER BY keyword sorts the records in ascending order by
default. To sort the records in descending order, use the DESC
keyword.
c) Syntax:
SELECT column1, column2,.....
FROM table_name
ORDER BY column1, column2,...... ASC|DESC;

Output:-
3) GROUP BY clause:-
a) The GROUP BY statement groups rows that have the same values
into summary rows, like “find the number of customers in each
country”.
b) The GROUP by statement is often used with aggregate functions
(COUNT(), MAX(), MIN(), SUM(), AVG()) to group the result-set
by one or more columns.
c) Syntax:
SELECT column_name(s)
FROM table_name
WHERE condition
GROUP BY column_name(s)
ORDER BY column_name(s);

Output:-

4) HAVING clause:-
a) The HAVING clause was added to SQL because the WHERE
keyword cannot be used with aggregate functions.
b) Syntax:
SELECT column_name(s)
From table_name
WHERE condition
GROUP BY column_name(s)
HAVING condition
ORDER BY column_name(s);

Output:-

SELECT COUNT (CustomerID), Country

From Customers
GROUP BY Country

HAVING COUNT(CustomerID)>5;

5) COUNT:-
a) The COUNT() function returns the number of rows that matches a
specified criterion.
b) Syntax:
SELECT COUNT(column_name)
FROM table_name
WHERE condition;

Output:-

6) SUM:-
a) The SUM() function returns the total sum of a numeric column.
b) Syntax:
SELECT SUM(column_name)
FROM table_name
WHERE condition;

Output:-
7) AVG:-
a) The AVG() function returns the average value of a numeric
column.
b) Syntax:
SELECT AVG(column_name)
FROM table_name
WHERE condition;

Output:-

8) Min/Max:-
a) The MIN() function returns the smallest value of the selected
column.
b) The MAX() function returns the largest value of the selected
column.
c) Syntax:-
SELECT MIN/MAX(column_name)
FROM table name
WHERE condition;

Output:-
Experiment 7

Use set operations to query the tables.

1) UNION:-
a) UNION will be used to combine the result of two select statements.
b) Duplicate rows will be eliminated from the results obtained after
performing the UNION operation.
c) Syntax:-
SELECT * from table 1 UNION SELECT * from table2;

Output:-

2) INTERSECT:-
a) It is used to combine two SELECT statements, but it only returns the
records which are common from both SELECT statements.
b) Syntax:
SELECT * from table1 INTERSECT SELECT * from table2;

Output:-
3) UNION ALL:-
a) This operator combines all the records from both the queries.
b) Duplicate rows will be not be eliminated from the results obtained
after performing the UNION ALL operation.
c) Syntax:
SELECT * from table1 UNION ALL SELECT * from table2;

Output:-

4) MINUS:-
a) It displays the rows which are present in the first query but absent in
the second query with no duplicates.
b) Syntax:
SELECT * from table1 MINUS SELECT * from table2;

Output:-
Experiment-8
Create joins and views on tables.

1) INNER JOIN:-
a) A JOIN clause is used to combine rows from two or more tables,
based on a related column between them.
b) The INNER JOIN keyword selects records that have matching values
in both tables.
c) Syntax:
SELECT column_name(s)
FROM table1
INNER JOIN table2
ON table1.column_name=table2.column_name;
Output:-

2) LEFT JOIN:-
a) The LEFT JOIN keyword returns all records from the left table
(table1), and the matching records from the right table (table2). The
result is 0 records from the right side, if there is no match.
b) Syntax:
SELECT column_name(s)
FROM table1
LEFT JOIN table2
ON table1.column_name = table2.column_name;

Output:-
3) RIHGT JOIN:-
a) The RIGHT JOIN keyword returns all records from the right table
(table2), and the matching records from the left table (table1). The
result is 0 records from the left side, if there is no match.
b) Syntax:
SELECT column_name(s)
FROM table1
RIGHT JOIN table2
ON table1.column_name = table2.column_name;

Output:-

4) VIEWS:-
a) In SQL, a view is a virtual table based on the result-set of an SQL
statement.
b) A view contains rows and columns, just like a real table. The fields in
a view are fields from one or more real tables in the database.
c) You can add SQL statements and functions to a view and present the
data as if the data were coming from one single table.
d) A view is created with the CREATE VIEW statement.
e) Syntax:
CREATE VIEW view_name AS
SELECT column1, column2,....
FROM table_name;

Output:-
Experiment-9
Search for specific pattern using LIKE operator.

1) The LIKE operator is used in a WHERE clause to search for a specific


pattern in a column.
2) The percent sign (%) wildcard represents zero, one or multiple characters.
3) The underscore sign (_) represents one, single character.

Syntax:-

SELECT column1, column2,....

FROM table_name

WHERE column LIKE pattern;

Output:-

1) Select all customers with CustomerName starting with “a”:


SELECT * FROM Customers
WHERE CustomerName LIKE ‘a%’;

2) Select all customers with CustomerName ending with “a”.


SELECT * FROM Customers
WHERE CustomerName LIKE ‘%a’.
3) Select all customers with CustomerName that have “or” in any position:
SELECT * FROM Customers
WHERE CustomerName LIKE ‘%or%,;
Experiment-10
Generate sub-queries in SQL.

Sub-Queries:-

1) A Subquery or Inner query or a Nested query is a query within another


SQL query and embedded within the WHERE clause.
2) A subquery is used to return data that will be used in the main query as a
condition to further restrict the data to be retrived.
3) Subqueries can be used with the SELECT, INSERT, UPDATE, and
DELETE statements along with the operators like =, <, >, <=, >=, IN,
BETWEEN, etc.

Syntax:-

SELECT column_name, [column_name]

FROM table1, [table2]

WHERE column_name OPERATOR

(SELECT column_name, [column_name]

FROM table1, [table2]

[WHERE]);

Output:-

You might also like