Sap NOTES
Sap NOTES
ALL Returns true if all of the subquery values meet the condition
ANY Returns true if any of the subquery values meet the condition
CHECK A constraint that limits the value that can be placed in a column
CREATE UNIQUE INDEX Creates a unique index on a table (no duplicate values)
CREATE VIEW Creates a view based on the result set of a SELECT statement
FOREIGN KEY A constraint that is a key used to link two tables together
FULL OUTER JOIN Returns all rows when there is a match in either left table or right
table
GROUP BY Groups the result set (used with aggregate functions: COUNT,
MAX, MIN, SUM, AVG)
HAVING Used instead of WHERE with aggregate functions
INNER JOIN Returns rows that have matching values in both tables
INSERT INTO SELECT Copies data from one table into another table
LEFT JOIN Returns all rows from the left table, and the matching rows from the
right table
LIKE Searches for a specified pattern in a column
NOT NULL A constraint that enforces a column to not accept NULL values
OUTER JOIN Returns all rows when there is a match in either left table or right
table
PRIMARY KEY A constraint that uniquely identifies each record in a database table
RIGHT JOIN Returns all rows from the right table, and the matching rows from
the left table
ROWNUM Specifies the number of records to return in the result set
SELECT INTO Copies data from one table into a new table
SELECT TOP Specifies the number of records to return in the result set
TRUNCATE TABLE Deletes the data inside a table, but not the table itself
UNION Combines the result set of two or more SELECT statements (only
distinct values)
UNION ALL Combines the result set of two or more SELECT statements (allows
duplicate values)
UNIQUE A constraint that ensures that all values in a column are unique
WHERE Filters a result set to include only records that fulfill a specified
condition
Some of The Most Important SQL
Commands
SELECT - extracts data from a database
a)
b)
2)
a)
b)
c)
3)
a)
b)
c)
4)
a)
b)
c)
5)
6)
a)
b)
C)
d)
e)
7)
8)
a)
b)
c)
d)
9)
a)
b)
10)
11)
12)
13)
14)
15)
The SQL SELECT Statement
Example
Return all the columns from the Customers table:
SELECT * FROM Customers
UPDATE Syntax
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
Example
The following SQL statement updates the first customer (CustomerID = 1) with a new contact person and a new city.
UPDATE Customers
SET ContactName = 'Alfred Schmidt', City= 'Frankfurt'
WHERE CustomerID = 1;
Example
UPDATE Customers
SET ContactName='Juan'
WHERE Country='Mexico';
Update Warning
Be careful when updating records. If you omit the WHERE clause, ALL records will be updated!
Example
UPDATE Customers
SET ContactName='Juan';
DELETE Syntax
DELETE FROM table_name WHERE condition;
Note: Be careful when deleting records in a table! Notice the WHERE clause in the DELETE statement. The WHERE clause specifi
record(s) should be deleted. If you omit the WHERE clause, all records in the table will be deleted!
Example
DELETE FROM Customers WHERE CustomerName='Alfreds Futterkiste';
Example
DELETE FROM Customers;
Delete a Table
To delete the table completely, use the DROP TABLE statement:
Example
Remove the Customers table:
DROP TABLE Customers;
Example
INSERT INTO Customers (CustomerName, City, Country)
VALUES ('Cardinal', 'Stavanger', 'Norway');
Example
INSERT INTO Customers (CustomerName, ContactName, Address, City, PostalCode, Country)
VALUES
('Cardinal', 'Tom B. Erichsen', 'Skagen 21', 'Stavanger', '4006', 'Norway'),
('Greasy Burger', 'Per Olsen', 'Gateveien 15', 'Sandnes', '4306', 'Norway'),
('Tasty Tee', 'Finn Egan', 'Streetroad 19B', 'Liverpool', 'L1 0AA', 'UK');
Syntax
CREATE DATABASE databasename;
The following SQL statement creates a database called "testDB":
CREATE DATABASE testDB;
Tip: Make sure you have admin privilege before creating any database. Once a database is created, you can check it in the
databases with the following SQL command: SHOW DATABASES;
Example
ALTER TABLE Customers
DROP COLUMN Email;
Example
ALTER TABLE Customers
DROP COLUMN Email;
Syntax
CREATE TABLE table_name (column1 datatype,column2 datatype,column3 datatype,…)
Example
ALTER TABLE Customers
DROP COLUMN Email;
Syntax
DROP TABLE table_name;
Note: Be careful before dropping a table. Deleting a table will result in loss of complete information stored in the table!
Syntax
TRUNCATE TABLE table_name;
Syntax
BACKUP DATABASE databasename
TO DISK = 'filepath';
Syntax
BACKUP DATABASE databasename
TO DISK = 'filepath'
WITH DIFFERENTIAL;
Tip: Always back up the database to a different drive than the actual database. Then, if you get a disk crash, you will not lo
backup file along with the database.
Example
BACKUP DATABASE testDB
TO DISK = 'D:\backups\testDB.bak'
WITH DIFFERENTIAL;
MAX Example
SELECT MAX(Price)
FROM Products;
Syntax
SELECT MIN(column_name)
FROM table_name
WHERE condition;
SELECT MAX(column_name)
FROM table_name
WHERE condition;
Syntax
SELECT COUNT(column_name)
FROM table_name
WHERE condition;
Example
Find the number of products where Price is higher than 20:
SELECT COUNT(ProductID)
FROM Products
WHERE Price > 20;
Specify Column
You can specify a column name instead of the asterix symbol (*).
If you specify a column instead of (*), NULL values will not be counted.
Example
Find the number of products where the ProductName is not null:
SELECT COUNT(ProductName)
FROM Products;
Syntax
SELECT SUM(column_name)
FROM table_name
WHERE condition;
Example
Return the number of orders made for the product with ProductID 11:
SELECT SUM(Quantity)
FROM OrderDetails
WHERE ProductId = 11;
Create Constraints
Constraints can be specified when the table is created with the CREATE TABLE statement, or after the table is created with th
TABLE statement.
Syntax
CREATE TABLE table_name (
column1 datatype constraint,
column2 datatype constraint,
column3 datatype constraint,
....
);
MySQL Constraints
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 i
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
table.
The following constraints are commonly used in SQL:
NOT NULL - Ensures that a column cannot have a NULL value
UNIQUE - Ensures that all values in a column are different
PRIMARY KEY - A combination of a NOT NULL and UNIQUE. Uniquely identifies each row in a table
FOREIGN KEY - Prevents actions that would destroy links between tables
CHECK - Ensures that the values in a column satisfies a specific condition
DEFAULT - Sets a default value for a column if no value is specified
CREATE INDEX - Used to create and retrieve data from the database very quickly
aggregrate function in SQL
An aggregate function in SQL performs a calculation on multiple values and returns a single value. SQL pr
many aggregate functions that include avg, count, sum, min, max, etc.An aggregate function ignores NULL
when it performs the calculation, except for the count function.
1) Count :-
SELECT COUNT(*) FROM (table name)
&
SELECT COUNT(coulamn name) FROM (table name)
4) SUM :- returns the out put total /sum value of numeric coulamn.
SELECT SUM (coulamn name) FROM (table name)
&
SELECT SUM (coulamn name) FROM (table name) WHERE (condition)
Group By
Group Rows that have the same values in specified columns.
SELECT (coulamn name/department) function (AVG/SUM/MIN/MAX/COUNT) FROM (table name) GROUP BY (coulamn name
eg:- SELECT department, COUNT(name) as no of employees FROM employee GROUP BY department
Having
Used with GROUP BY to specify conditions & filter data
SELECT (coulamn name) , FUNCTION(AVG/SUM/MIN/MAX/COUNT) (coulamn name) FROM (table name) GROUP BY (coulamn
eg:- SELECT department, AVG (salary) FROM employee GROUP BY department HAVING AVG(salary) >15000
CREATE DATABE
SYNTEX :- CREATE DATABASE (database name)
CREATE TABLE
SYNTEX :- CREATE TABLE table name ( coulam1 int8 PRIMARY KEY,coulam2 VARACHAR(50));
SELECT
INSERT
epartment)
WHERE IS USED FOR FILTER CONDITION ON WHOLE TABLE AND HAVING IS USED FOR FILTER ON GROUP DATA
300
150
100
50
0
misclenious Total Result
Sum of Amount
misclenious
100%
500
450
Sum of Amount
400
350
300
Axis Title
250
Sum of Amount misclenio
200
Column C Total Res
150
100
50
0
misclenious Total Result
misclenious
Axis Title 100%
misclenious
Total Result
total 5200
SUM Average 520
CONDITIONAL FORMATING
FILTER
UNIQUE
SUMIF
INSERT SLICER
UNIQUE Catogri Amount
#NAME? 1730
#NAME? 1510
#NAME? 460
#NAME? 1500
V LOOKUP
H LOOKUP
PIVOTE
INDEX
MATCH
INDEXMATCH
MACROS
CONDITIONAL FORMATING
What IFRS means?
international financial reporting standards
What is IFRS? IFRS stands for international financial reporting standards. It's a set of accounting rules and standard
GAAP
The generally accepted
What are the 4 basic principle
Companies can use these analytical tools to identify areas of inefficiency and make corrective recommend
1. Planning: This phase involves understanding the scope and objectives of the au
2. Risk Assessment: In this phase, auditors evaluate the risks associated with the
3. Testing: This phase is about collecting and analyzing evidence to determine the
4. Reporting: In this phase, auditors report their findings to management and stake
5. Follow-up: During this last phase, auditors monitor the progress of corrective ac
15 types of audits
Here are 15 types of audits businesses and agencies may conduct:
1. Internal audit
A team or individual employee within an organization can conduct internal audits. This type of audit can he
Operations concerns
Read more: 8 Common Internal Auditor Interview Questions and Answers
2. External audit
Unbiased third parties, such as government agencies and financial companies, conduct external audits. A
For example, a clothing retailer may hire an outside auditing agency to check for ways to improve inventor
Related: Learn About External vs. Internal Audits (Four Key Differences)
3. Tax audit
Agents of the IRS conduct tax audits to verify that the information filed on a company's tax returns is accur
The existence of a tax audit doesn't indicate any wrongdoing on the part of the company. The IRS choose
Related: What Is Asset Auditing? (Plus How It Can Help a Business)
4. Financial audit
Financial audits focus specifically on an organization's financial status. Auditors are responsible for verifyin
5. Operational audit
Operational audits are designed to evaluate and analyze an organization's operations, including policies, p
For example, a manufacturer may conduct an audit of the company's supply chain to identify ways to redu
6. Compliance audit
Compliance audits are used to determine if companies are compliant with internal and external regulations
Companies conduct compliance audits to maintain safe and fair working conditions, ensure product quality
Information system audits review your team's information technology to ensure you're using best practices
Recommend software and equipment for specific business needs, such as project m
8. Payroll audit
Payroll audits verify the accuracy of all information related to payroll processing, including:
Tax withholding
9. Pay audits
Pay audits analyze pay data related to a team of employees to determine any inequalities among gender,
Integrated audits deal primarily with how an organization monitors and controls its financial accounting and
Forensic audits are highly technical audits often conducted as part of a criminal or civil investigation. Forensic audit
Statutory audits are audits conducted to comply with government regulations for public companies, banks,
Bank statements
Investment earnings
Many government agencies undergo statutory audits and make the findings available to the public, which
Value-for-money audits are often implemented in nonprofit organizations to assess resource management
For example, an auditor may discover a home-building charity that's overpaying for supplies. The auditor m
During an agreed-upon procedures (AUP) audit, the parties requesting the audit and the party or parties c
Companies can also use AUP audits to learn more about a company they want to merge with or acquire. I
Special audits are typically internal audits that focus on a narrow function or process within a company. Ow
Safety compliance
Construction
Hiring procedures
Fraud
Royalties
Taxes
See how your salary compares
Get personalized salary insights with the Indeed Salary Calculator
In some industries, such as healthcare and finance, audits are a mandatory process to comply with regula
accounting rules and standards that determine how accounting events should be reported in your business's financial statements.
nerally accepted standards for financial reporting in the United States. IFRS stands for International Financial Reporting Standar
ciples-based approach.
ally and is better for companies that operate in multiple countries, while GAAP is more focused on the US and is better for comp
use the US government has not adopted it as the official accounting standard. The US instead uses its own set of Generally Ac
. Under GAAP, inventory must be valued at the lower of cost or market value, while IFRS requires inventory to be valued at the
GAAP
The generally accepted accounting principles (GAAP) are a set of accounting rules, standards, and procedures issu
What are the 4 basic principles of GAAP?
y, such as financial records. There are different categories of audits, and companies can perform them internally or hire an external organi
make corrective recommendations. Other audits check for noncompliance or wrongdoing. Depending on the type of audit, a bus
th specific objectives that auditors meet before they move on to the next phase. Here are the typical phases of an audit:
nd objectives of the audit, identifying the resources and personnel required to complete the audit and
ks associated with the areas under audit. They identify and assess the likelihood of fraud, errors or m
ence to determine the effectiveness of controls, accuracy of financial statements and completion of c
management and stakeholders, including any deficiencies or areas that require improvement.
gress of corrective actions in response to the audit findings and verify the identification and resolutio
ts. This type of audit can help executives and stakeholders get an accurate understanding of a company's health. Company ow
, conduct external audits. Auditors adhere to the Generally Accepted Auditing Standards (GAAS) when handling a company's in
mpany's tax returns is accurate, ensure tax payments are correct and confirm the proper reporting of tax liabilities. Agents will a
company. The IRS chooses companies to audit each year based on a variety of data.
s are responsible for verifying a company's records, including expenses, revenue, investments and assets. They usually compi
erations, including policies, procedures, goals, philosophies and culture. Usually conducted internally, this type of audit seeks to
hain to identify ways to reduce costs and streamline product delivery procedures.
nal and external regulations, which may include company standards, local regulations and state and federal laws.
tions, ensure product quality and minimize risks. For instance, a factory manager may commission quarterly compliance audits
e you're using best practices for systems management and security. Companies in software, IT and other tech industries rely on
g, including:
e company who perform these audits. They ensure that the business has the most up-to-date employee information and that th
inequalities among gender, race, age or religion. Auditors compare a company's wages to that of similar companies to ensure t
s its financial accounting and reporting and are required for certain companies. Auditors adhere to strict guidelines developed by
il investigation. Forensic auditors apply both accounting knowledge and investigative procedures. Some may use the results of these audit
or public companies, banks, investment firms and insurance companies. They're generally external audits that verify certain fina
bute resources.
e organizations are at using their resources to meet their overall financial and operational goals.
g for supplies. The auditor might recommend that the company research alternate suppliers, helping them redistribute funds to
dit and the party or parties conducting the audit agree to certain terms. Companies typically use AUP audits to evaluate a specif
t to merge with or acquire. In AUP audit reports, auditors share objective information rather than recommendations or opinions.
ocess within a company. Owners, shareholders or upper-level management may authorize special audits. Sometimes a specia
y business. By conducting regular audits, teams can identify potential risks, improve operational efficiency and maintain transpa
ocess to comply with regulatory requirements. Even in industries where audits are not required by law, they're still a best practi
financial statements.
Financial Reporting Standards, which are a set of internationally accepted accounting standards used by most of the world’s co
its own set of Generally Accepted Accounting Principles (GAAP). The US government has indicated that it is considering adop
nventory to be valued at the lower of cost or net realizable value. Additionally, GAAP does not allow for any inventory write-dow
ards, and procedures issued and frequently revised by the Financial Accounting Standards Board (FASB)
nally or hire an external organization to conduct them. Auditors review and report on a department, process, policy or function within a co
g on the type of audit, a business may share the results with company owners or government agencies.
l phases of an audit:
improvement.
mpany's health. Company owners or shareholders typically commission an internal audit, which may focus on the following types
hen handling a company's information. External audits can be more official than internal audits and are often used to demonstra
of tax liabilities. Agents will access a company's complete financial records and may conduct tax audits on-site, over the phone
assets. They usually compile this information into a final determination for investors or shareholders.
y, this type of audit seeks to identify inefficiencies and make recommendations to reduce costs, streamline processes and impro
d federal laws.
quarterly compliance audits to ensure employees follow safety guidelines for using and maintaining equipment, cleaning facilitie
milar companies to ensure the payroll data is comparable. Reviewing this information can help the company remain competitive
trict guidelines developed by the Public Company Accounting Oversight Board (PCAOB) when conducting these audits. They id
y use the results of these audits as evidence in legal proceedings or to resolve disagreements between corporations or company sharehold
audits that verify certain financial reports are accurate and compliant, including:
operational goals.
P audits to evaluate a specific process or procedure and they only share the results with the parties named in the agreement. F
commendations or opinions.
audits. Sometimes a special audit is the result of a specific allegation of fraud or misconduct. Special audits may investigate:
ciency and maintain transparency with stakeholders. Audits can also help teams detect and prevent fraud, errors and other irre
aw, they're still a best practice for maintaining good corporate governance and minimizing risk.
ed by most of the world’s countries. The key differences between GAAP and IFRS include:
for any inventory write-downs, whereas IFRS does. Lastly, GAAP requires that inventory be valued using a specific cost flow a
Board (FASB) . Public companies in the U.S. must follow GAAP when their accountants compile their financial statem
, policy or function within a company.
focus on the following types of investigations:
are often used to demonstrate the reliability of a company's financial and operational records.
dits on-site, over the phone or digitally. A tax audit is an external audit because the agent works for an outside entity and is unre
amline processes and improve policies.
ducting these audits. They identify and evaluate how a company oversees transactions, financial processes and operations.
orations or company shareholders. For example, an anti-fraud agency may investigate an investment company to verify the legal managem
named in the agreement. For example, an organization executive may decide to audit how the product development division us
al audits may investigate:
fraud, errors and other irregularities that can harm their reputation and financial stability. Additionally, audits provide valuable i
d using a specific cost flow assumption (such as FIFO or LIFO) while IFRS does not.