Professional Documents
Culture Documents
1. Create a database:
Lets create a database.
Create a database using CREATE statement.
Syntax: create database cricket;
Output:
2. Next, verify that the database was created by showing a list of all
databases. Use the SHOW statements.
Syntax:-show databases;
Output:
Syntax:use database_name;
Output:
DDL COMMANDS:
1. CREATE COMMAND:
Output:
Syntax:-
Syntax:
ALTER TABLE TableName ADD ColumnNameData_Type;
ALTER TABLE TableName DROP ColumnName;
ALTER TABLE TableName MODIFY COLUMN ColumnName Data_Type;
3. DROP COMMAND:
Syntax: Drop table tablename;
4. TRUNCATE COMMAND
Syntax:Truncate table tablename;
Output:
DELETE STATEMENT
Syntax :
Note: The WHERE clause specifies which record(s) should be deleted. If you omit the WHERE
clause, all records in the table will be deleted!
Logical OR Operator:
The OR operator in Oracle is useful to add multiple conditions in a single SQL
statement. It displays the data rows if any one of the multiple conditions is TRUE. If
all the conditions are false the SQL statement won’t return any result set.
Let’s modify the SQL statement so that both conditions become FALSE.
Logical NOT Operator:
Output:-
Nested Logical Operators:
We can also use multiple logical operators in a single SQL statement. When we
combine the logical operators in a SELECT statement, the order in which the statement
is processed is
1. NOT
2. AND
3. OR
Nested Logical Operators Example:
Output:-
In this case, the rows that satisfy at least one of the above conditions are returned.
IN Operator:
Returns true if the value is available in the given list of values. Supports with all types
of data (data types).
Output:-
Between Operator Example:
If you want to fetch all the employees from the yar table where the employee age is
between 20 and 22, then we need to write the SELECT SQL Query using the Between
Operator.
Output:-
Output:-
Equal (=) Relational Operator
The Equal (=) Operator is used to check whether the two expressions are equal or not.
If both the expressions are equal then the condition becomes true and will return the
matched rows.
ABS() Function:
Syntax: ABS(number)
2) CEIL() Function:
Syntax: CEIL(NUMBER);
Output:-
3) FLOOR( ) Function:
Syntax: FLOOR(NUMBER)
Output:-
4) MOD() Function:
Syntax: MOD(m, n)
5) POWER() Function:
Syntax: POWER(m, n).
Output:-
6) ROUND() Function:-
Syntax: ROUND(NUMBER,[DECIMAL PLACES])
Output:-
COUNT() Function:
The COUNT function is used to count the data rows returned in the result set.
Syntax:
SELECT COUNT(*) FROM tablename;
Example:
The table which is created to perform aggregate functions is shown below.
Syntax:-
SUM Function:
The SUM Function is used to return the total sum of a given numeric column. The
SUM function will only work on numeric data types.
Syntax:
Output:-
MIN() Function in Oracle
The MIN function in Oracle is used to return the smallest value of the given column.
The MIN function works on numeric columns as well as string columns.
Syntax:
SELECT MIN(columnname) FROM tablename;
MAX() Function
The MAX function is used to return the largest value of the given column. The MAX
function works on numeric columns as well as string columns.
Syntax:
SELECT MAX(columnname) FROM tablename;
AVG Function
The AVG or AVERAGE function is used to return the average value of the given
numeric column. The AVG function will only work on numeric columns.
Syntax:
SELECT AVG(columnname) FROM tablename;
WEEK-3
Installation of cloudera
Aim: To install the cloudera and performing various hdfs file systems. Listing of files and
exploring dictionaries.
1. Download cloudera quickstart vm and extract the zip into a particular folder.And now
click as shown in below.
2. Configure the VM settings include the amount of ram cpu and etc.And after click on
import button.
3. After click on the import button; it will start to importing the files to oracle virtual
box.
Exploring hdfs
Aim:- performing various hdfs file systems. Listing of files andexploring dictionaries.
1.After you can see your cloudera interface as shown in below image.
Listing files using ls and creating directory using mkdir command.