10th DBMS Important Commands
10th DBMS Important Commands
10thDatabaseManagementSystem
What is SQL?
SQL stands for Structured Query Language
SQL lets you access and manipulate databases
SQL became a standard of the American National
Standards Institute (ANSI) in 1986, and of the International
Organization for Standardization (ISO) in 1987
COUNT(DISTINCT
Country)
21
Example
SELECT * FROM Customers
WHERE Country='Mexico';
OUTPUT:
UPDATE Customers
SET ContactName='Vibhu'
WHERE Country='INDIA';
Dangerous:
UPDATE Customers
SET ContactName='Jadu';
Example
CREATE TABLE Persons (
PersonID int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
);
Create Table Using Another Table
Syntax
DROP TABLE table_name;
Example
DROP TABLE Shippers;
Syntax
TRUNCATE TABLE table_name;
SQL ALTER TABLE Statement
Syntax:
ALTER TABLE table_name
ADD column_namedatatype;
Example
ALTER TABLE Customers
ADD Email varchar(255);
Example
ALTER TABLE Customers
DROP COLUMN Email;
MAX() Function
POWER() Function
The POWER() function returns the value of a number raised
to the power of another number.
SELECT POWER(4, 2);
Parameter Values
Parameter Description
SUM() Function
AVG() Function
COUNT() Function
LOWER() Function
The LOWER() function converts a string to lower-case.
SELECT LOWER('SQL Tutorial is FUN!');
LEN() Function
The LEN() function returns the length of a string.
SELECT LEN('School is as school');
Forms:
Forms are used to collect data, display results of the
queries, perform computations etc. Reports are used to
give the summary data.
Reports:
Database Reports are created from data visualized for
analysis, data discovery, and decision-making, and
contains useful data for decision-making and analysis. Most
business applications come with a built-in reporting tool,
which is a front-end interface that calls back-end database
queries.