useless
useless
MYSQL – SQL
DATABASE CONCEPTS:
SQL: Structured Query Language is a unified, non procedural language used for creating,accessing
handling and managing data in relational databases.
Features of SQL:
1. Retrieve data from database through Query processing.
2. Insert records into database
3. Update records into database
4. Create new and modify
5. Create new tables
6. Create views
7. Allow modify security settings
Advantages of SQL
1. Ease of Use
2. Large Volume of data
3. No coding required
4. High Level Languages
5. Portable
6. Not a Case sensitive language
7. Powerful Language
8. Reliable
9. Freedom of data abstraction
10. Complete Language for a database
2
• A data model describes the structure of the database, including how data
are defined and represented, relationships among data, and the
constraints. The most commonly used data model is Relational Data ModeL
• In relational model, tables are called relations that store data for different
columns. Each table can have multiple columns where each column name
should be unique. For example, each row in the table represents a related
set of values
❖ Attribute : columns of a relation
❖ Tuple : rows of a relation
❖ Domain : It is a set of values from which an attribute can take a value in
each row
❖ Degree : The number of attributes in a relation is called the Degree of the
relation
❖ Cardinality : The number of tuples in a relation is called the Cardinality of
the relation
❖ Candidate Key : A relation can have one or more attributes that takes
distinct values. Any of these attributes can be used to uniquely identify the
tuples in the relation. Such attributes are called candidate keys as each of
them are candidates for the primary key
NOTE : There are many RDBMS such as MySQL, Microsoft SQL Server,
PostgreSQL, Oracle, etc.
4
➢ Data type indicates the type of data value that an attribute can have and
the operations that can be performed on the data of that attribute
FLOAT Holds numbers with decimal points. Each FLOAT value occupies
4 bytes.
DATE The DATE type is used for dates in 'YYYY-MM-DD' format. YYYY
is the 4 digit year, MM is the 2 digit month and DD is the 2 digit
date
5
• SQL queries:
DDL Commands
1. CREATE Syntax : Example :
DATABASE CREATE DATABASE CREATE DATABASE
<DBNAME>; EMP_DATA;
2. For using Syntax : Example :
/opening USE <DBNAME>; USE EMP_DATA;
Database
3. To show all Syntax : Example :
available SHOW DATABASES; SHOW DATABASES;
databases
4. To create table Syntax : Example :
CREATE TABLE CREATE TABLE EMP
<table_name> (EMPNO INT ,
(<col_name> ENAME VARCHAR(20),
<datatype> <size> SALARY INT);
constraint,
<col_name> CREATE TABLE EMP
<datatype> <size> (EMPNO INT PRIMARY KEY,
constraint,---------- ENAME VARCHAR(20),
); SALARY INT);
OR
Syntax:
SELECT * FROM Example :
tablename; SELECT * FROM STUDENT;
Output:-
8
Output:-
9
By default
displays
records in
ascending
order
To display the
The following query displays
records in
details of all the employees in
descending
descending order of their
order, the
salaries.
DESC keyword
written
mysql> SELECT * FROM
EMPLOYEE ORDER BY Salary
DESC;
Output:-
10
Output:-
Output:-
single char
➢ Displays details of all
those employees whose name
ends with 'a'.
SQL OPERATORS
1. Arithmetic Operators
2. Relational Operators
3. Logical Operators
4. Special Operators
Arithmetic Operators:
Ex:
mysql>SELECT 5+10;
or
mysql>SELECT 5+10 FROM DUAL;
Relational Operators:
mysql>Select * from Student Where Marks>=90
Logical Operators:
1. And
2. Or
3. Not
Ex:And
mysql>Select * from Student where Marks>80 and Gender=’M’;
Ex:Or
mysql>Select Rollno,Name,Stream from student where Stream=’Science’ Or
Stream=’Commerce’;
Ex:Not
mysql>Select Name,Marks from Student where not(Stream=’Vocational’);
13
Special Operators:
1. Between…..And
2. Not Between
3. IN
Syntax:
mysql>Select<column_name> From<table_name> Where<column_name> Between
<value1>And<value2>;
Ex:
Mysql> Select Rollno,Name,Marks from student where Marks Between 80 and 100;
Not Between
Ex: Select Rollno,Name,Marks from student Where Marks Not Between 80 And 100;
In:
Syntax: SELECT<column_name> FROM<tablename> WHERE<column_name> IN
(value1,value2);
Ex: Select * from student where stream In(‘Science’,’Commerce’,’Humanities’);
Not In:ex
SELECT * FROM Student WHERE Stream NOT in(‘Science’,’Commerce’,’Humanities’);
14
5. Insert the rows in above table GYM. INSERT INTO GYM VALUES
(‘G101’, ‘Power fit exerciser’ ,
20000 , ‘ABC’);
Write SQL query for the following on the basis of Table EMP given below:
15
EMERGING TRENDS
ARTIFICIAL INTELLIGENCE
Artificial Intelligence endeavours to simulate the natural
intelligence of human beings into machines, thus making them
behave intelligently. An intelligent machine is supposed to imitate
some of the cognitive functions of humans like learning, decision-
making and problem solving. AI system can also learn from past
experiences or outcomes to make new decisions.
MACHINE LEARNING
Machine Learning is a subsystem of Artificial Intelligence,
wherein computers have the ability to learn from data using
statistical techniques, without being explicitly programmed by a
human being. It comprises algorithms that use data to learn on
their own and make predictions. These algorithms, called models,
are first trained and tested using a training data and testing data,
respectively.
BIGDATA
Big data is data that contains greater variety, arriving in increasing
volumes and with more velocity. Our posts, instant messages and
chats, photographs that we share through various sites, our
tweets, blog articles, news items, opinion polls and their
comments, audio/video chats etc. Big data not only represents
voluminous data, it also involves various challenges like
integration, storage, analysis, searching, processing, transfer,
querying and visualisation of such data.
IOT THINGS
Internet of things (IoT), is an entity or physical object that has a
unique identifier, an embedded system and the ability to transfer data over
a network.
The Internet of Things refers to the rapidly growing network of connected
objects that are able to collect and exchange data in real time using
embedded sensors. Thermostats, cars, lights, refrigerators, and more
appliances can all be connected to the IoT.
CLOUD COMPUTING
Cloud computing is an emerging trend in the field of
information technology, where computer-based services are
delivered over the Internet or the cloud. The services comprise
software, hardware (servers), databases, storage, etc. These
resources are provided by companies called cloud service providers.
Cloud computing offers cost-effective, on-demand resources. A user
can avail need-based resources from the cloud at a very reasonable
cost. We already use cloud services while storing our pictures and
files as backup on Internet, or host a website on the Internet.
BLOCKCHAINS