SQL, or Structured Query Language, is a powerful and versatile programming language used for managing and manipulating relational databases. With its intuitive syntax and wide-ranging capabilities, SQL has become a cornerstone of modern data management systems, enabling users to interact with databases efficiently and effectively.
One of the primary functions of SQL is to retrieve data from databases using queries. These queries allow users to specify the data they want to retrieve, filter it based on certain criteria, and perform various operations on it. SQL queries typically consist of several components, including:
1. **SELECT statement**: The SELECT statement is used to specify the columns of data that should be retrieved from the database. It allows users to choose which fields they want to include in the query's results.
2. **FROM clause**: The FROM clause specifies the table or tables from which the data should be retrieved. It identifies the source of the data for the query.
3. **WHERE clause**: The WHERE clause is used to filter the data based on specific conditions. It allows users to narrow down the results of their query by specifying criteria that must be met by the data.
4. **JOIN clause**: The JOIN clause is used to combine data from multiple tables in a database. It allows users to create relationships between tables based on common fields and retrieve data that spans multiple tables.
5. **GROUP BY clause**: The GROUP BY clause is used to group the results of a query based on one or more columns. It allows users to aggregate data and perform calculations on groups of records rather than individual records.
6. **HAVING clause**: The HAVING clause is used in conjunction with the GROUP BY clause to filter groups of data based on specific conditions. It allows users to apply conditions to groups of records after they have been grouped by the GROUP BY clause.
7. **ORDER BY clause**: The ORDER BY clause is used to sort the results of a query based on one or more columns. It allows users to specify the order in which the data should be displayed.
SQL also provides a wide range of functions and operators for performing calculations, manipulating strings and dates, and performing various other tasks. These functions and operators enhance the flexibility and power of SQL queries, enabling users to perform complex operations on their data with ease.
In addition to querying data, SQL is also used for managing database structures, creating and modifying tables, defining relationships between tables, and enforcing constraints to maintain data integrity. SQL's data definition language (DDL) allows users to create, alter, and drop database objects such as tables, indexes, and views, while its data manipulation language (DML) allows users to insert, update, delete, and retrieve data from tables.
Overall, SQL is a fundamental tool for working with relational databases, providing users with the ability to retrieve, manipulate, and manage
2. XP
Contents
1. Identify excel components
2. Descriptions of Excel
components
3. Excel’s arithmetic operators
4. Know the order of precedence
5. Cell Referencing
6. Work with the Insert Function
button
7. Math and Statistical functions
8. Define functions, and functions
within functions
9. Examine the Insert Function
dialog box
10.Create column and pie charts in
Excel
11. Create a chart using the Chart
Wizard
12. Use of If
13. Count Function
14. Function Auditing
15. Sorting
16. Shortcut Keys
17. Add data and record a basic
script
18. create
5. XP
3. Excel’s arithmetic operators
Arithmetic operations, symbols and description of their use.
5
6. XP
4. Know the order of precedence
The order of precedence rules must be considered when creating
expressionsmomo. The chart below illustrates Excel’s order of
precedence and shows sample expressions and the result of each
expression.
6
10. XP
6. Work with the Insert Function
button
• Excel supplies more than 350 functions organized
into 10 categories:
– Database, Date and Time, Engineering, Financial,
Information, Logical, Lookup, Math, Text and Data,
and Statistical functions
• You can use the Insert Function button on the
Formula bar to select from a list of functions.
• A series of dialog boxes will assist you in filling in
the arguments of the function and this process also
enforces the use of proper syntax.
10
11. XP
7. Math and Statistical functions
This chart shows some commonly used math and
statistical functions and a description of what they do.
11
12. XP
8. Define functions, and
functions within functions
• The SUM function is a very commonly used math function
in Excel.
• A basic formula example to add up a small number of cells
is =A1+A2+A3+A4, but that method would be
cumbersome if there were 100 cells to add up.
• Use Excel's SUM function to total the values in a range of
cells like this: SUM(A1:A100).
• You can also use functions within functions. Consider the
expression =ROUND(AVERAGE(A1:A100),1).
– This expression would first compute the average of all the values
from cell A1 through A100 and then round that result to 1 digit to
the right of the decimal point
12
13. XP
9. Examine the Insert Function
dialog box
This dialog box appears when you click the Insert Function
button. It can assist you in defining your function.
13
14. XP
10. Create column and pie
charts in Excel
• Charts, or graphs, provide visual representations of the
workbook data.
• A chart may be embedded in an existing worksheet, or can
be created on a separate chart sheet, with its own tab in the
workbook.
• You can use Excel’s Chart Wizard to quickly and easily
create charts.
• The Chart Wizard is a series of dialog boxes that prompt
you for information about the chart you want to generate
14
15. XP
11. Create a chart using
the Chart Wizard
• To create a chart with the Chart Wizard:
– Select the data you want to chart, which will be your data source
– Click the Chart Wizard button on the standard toolbar
– In the first step of the chart wizard, select the chart type and sub-
type
– In the second step of the Chart Wizard, make any additions or
modifications to the chart's data source
– In the third step, make any modifications to the chart's appearance
– In the fourth and final step, specify the location for the chart, then
click the OK button
15
16. XP
11 Contd. Chart Wizard dialog box 1
Choose a chart type and view examples of that type in dialog box 1.
Choose which type of chart
you want in this pane.
Select a sub-type of
that chart in this pane.
Click and hold this
button down to see a
preview of your chart.
16
17. XP
11 Contd. Choosing a data series
• You can alter the data source during step 2 of the Chart
Wizard and also choose whether to organize the data
source by rows or by columns.
• The data source is organized into a collection of data
series.
– A data series consists of data values, which are plotted on the
chart's vertical, or Y-axis
– The data series’ category values, or X values, are on the horizontal
axis, called the X-axis
• A chart can have several data series all plotted against a
common set of category values.
17
18. XP
11. Contd. Chart Wizard dialog box 2
During the second step of the
Chart Wizard, you specify
the data to be displayed
in the chart, which is also
known as the chart's data
source.
Specify the cell range and
whether the data series is in
rows or columns.
18
19. XP
11. Contd. Chart Wizard dialog box 2
During the second step of the
Chart Wizard, you specify
the data to be displayed
in the chart, which is also
known as the chart's data
source.
Specify the cell range and
whether the data series is in
rows or columns.
19
20. XP
11. Contd. Chart Wizard dialog box 2
During the second step of the
Chart Wizard, you specify
the data to be displayed
in the chart, which is also
known as the chart's data
source.
Specify the cell range and
whether the data series is in
rows or columns.
20
21. XP
11. Contd. Chart Wizard dialog box 2
During the second step of the
Chart Wizard, you specify
the data to be displayed
in the chart, which is also
known as the chart's data
source.
Specify the cell range and
whether the data series is in
rows or columns.
21
22. XP
• To allow for three or more outcomes
• One IF function is placed inside another IF
function to test an additional condition
• More than one IF function can be nested
12. Creating Nested IFs
22
24. XP
Summarizing Data Conditionally
• Use COUNTIF, SUMIF, and AVERAGEIF
functions to calculate a conditional count, sum, or
average using only cells that meet a particular
condition
12 Contd. Use of Different If
Function
24
25. XP
Using the COUNTIF Function
• Calculates the number of cells in a range that match
specified criteria
• Sometimes referred to as a conditional count
• Syntax:
12 Contd. Use of Different If
Function
25
26. XP
Using the SUMIF Function
• Adds values in a range that meet your criteria
• Also called a conditional sum
• Syntax:
12 Contd. Use of Different If
Function
26
32. XP
17. Add data and record a basic script
• Create a new Excel workbook.
• Copy the following fruit sales data and paste it into the worksheet,
starting at cell A1.
• Open the Automate tab. If you don't see the Automate tab, check the
ribbon overflow by selecting the drop-down arrow.
• Select the Record Actions button.
• Select cells A2:C2 (the "Oranges" row) and set the fill color to orange.
• Stop the recording by selecting the Stop button. 32
33. XP
18. Contd. Edit an existing script
The previous script colored the "Oranges" row to be orange. Let's add a yellow
row for the "Lemons".
1. From the now-open Details pane, select the Edit button.
2. You should see something similar to this code:
This code gets the current worksheet from the workbook. Then, it sets
the fill color of the range A2:C2.
33
34. XP
18. Contd. Edit an existing script
3. Add the following line to the end of the script (between where the color is
set and the closing }):
selectedSheet.getRange("A3:C3").getFormat().getFill().setColor("yellow
");
4. Test the script by selecting Run. Your workbook should now look like this:
34
35. XP
18. Contd. Create a Table
Let's convert this fruit sales data into a table. We'll use our
script for the entire process.
1. Add the following line to the end of the script (before the
closing }):
let table = selectedSheet.addTable("A1:C5", true);
1. That call returns a Table object. Let's use that table to sort the
data. We'll sort the data in ascending order based on the values in
the "Fruit" column. Add the following line after the table
creation:
table.getSort().apply([{ key: 0, ascending: true }]); 35
36. XP
18. Contd. Create a Table
Your script should look like this:
function main(workbook: ExcelScript.Workbook) {
// Set fill color to FFC000 for range Sheet1!A2:C2
let selectedSheet = workbook.getActiveWorksheet();
selectedSheet.getRange("A2:C2").getFormat().getFill().setColor("FFC000");
selectedSheet.getRange("A3:C3").getFormat().getFill().setColor("yellow");
let table = selectedSheet.addTable("A1:C5", true);
table.getSort().apply([{ key: 0, ascending: true }]);
}
3. Run the script. You should see a table like this:
36
37. XP
18. Contd. Re-run the script
1. Create a new worksheet in the current workbook.
2. Copy the fruit data from the beginning of the tutorial and paste
it into the new worksheet, starting at cell A1.
3. Run the script.
37