0% found this document useful (0 votes)
6 views

SQL1 Introduction and Installation

Uploaded by

Dhanunjay Rao
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

SQL1 Introduction and Installation

Uploaded by

Dhanunjay Rao
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

Data:

=====

Data is the collection of figures,images,sketches,numbers,etc.

Database:
=========

Database is the location to store the data in formal way and in organized manner.

Types of databases:
=====================

1.RDBMS(Relational Database Management System)


2.NoSQL Database
3.Graph database
4.Columnar database
5.XML and JSON database
6.Object oriented database
7.Centralized database
8.Customized database
9.NewSQL database

1.Relational Database Management System(RDBMS):

RDBMS is structured data which is presented in a tabular form with rows and columns
in it.

Ex:MySQL,Microsoft access,Postgresql,oracle,etc

2.NoSQL database:

NoSQL database is an unstructured database which means the data cannot be presented
in tabular form.

Ex:MongoDB,Apache cassandra,etc.

3.Graph database:

For working out with huge and large data and to display the data in graphical
formats,graph database is used.Graph database is also used for complex and
analytical calcualtions.

Ex:Neo4j

4.Columnar Database:

In this type of database,all the data is represnted in columns insted of tabular


form.This is used for small data applications.

Ex:Redit,etc

5.XML and JSON database:

This is also a structured a database which is organized in "names" and "values".The


combination of names and values are known as "pairs"

The data is always stored in XML sheets or JSON(Javascript Object Notation)

6.Object oriented database:

This type of database have complexity in executing and working the data.Some
domains with high privacy rate will only be worked with object oriented database.

Ex:Apache H Base

Database Management System(DBMS):

1.DBMS always doesnt provides strict rules to organize the data.


2.In DBMS,the data is hirechical and navigated from one data to another.
3.Users and Privileges are not applicable in DBMS.

RDBMS(Relational Database Management System):

Due to flaws and drawbacks in DBMS,RDBMS came into picture.

1.RDBMS always uses the data in structured format


2.Users and privileges are applicable in RDBMS which means one user can grant and
revoke the permissions from one user to another
3.The data can be easily accessed and retrieved
4.The data is easy to store
5.RDBMS enforces strict rules to workout with the data
6.One who have worked any tool in RDBMS,can easily understand the remaining tools.
In mysql----"YYYY-MM-DD"
In oracle----"Day-Month-year"
7.RDBMS is always associated with LAMP(Linux,Apache,MongoDB,php/pearl/python)

SQL(Structured Query Language):

*SQL is a declarative language which means it doesnt consists of programs and


logics

*SQL is language itself but it is not at all the database

*SQL was initially named as SEQUEL(Structered Query English Language)

*SQL was published in the year of 1970.

*SQL was developed by IBM

*The developers of SQL is Raymond D Chamberlin and Donald F Boycce

What is the difference between SQL and MySQL?

SQL:SQL is a structured query language which is used to work out with RDBMS tools.

MySQL:MySQL is an open sourced tool which is used to workout with SQL

Most probably used SQL tools in real time:

1.MySQL workbench
2.SQL Lite3
3.PostgreSQL
4.Oracle
5.Microsoft Access
6.Microsoft Server +
7.MongoDB----->Unstructured data

Advantages of MySQL:

1.The data can easily retrived and organized


2.The data can be stored for a long time without any errors and drawbacks.
3.Users and priveleges make the one user to access the another data
4.SQL is easy to understand due to its simple english which can be easily
understanble
5.MySQL makes the querying easier

Real time usage of MySQL:

1.Educational System
a)Students b)Staff c)Exams d)Lab equipments
e)Fee structures

2.Hospitals
a)Patients b)Doctors c)Staff d)Equipment

3.Trading
a)Business b)assests c)profits and losses

4.Election system
a)Voters b)Contestants c)Constituencies d)Zones
e)Ballots

How to install MySQL workbench?

1.Go to any search engine.


2.Enter "MySQL download"
3.Go to MySQL Download page
4.Follow the procedure and download the MySQL workbench

Basic commands to create and insert the data into table:

How to create database?

create database database_name;

How to create table?

create table dbname.table_name(Column_name datatype);

How to display the table?

select * from dbname.table_name;

How to use database?


use database_name;

How to describe the table;

desc table_name;

How to run the mysql workbench in command prompt?

1.Go to C:
2.Click on Program files
3.Click on MySQL
4.Click on MySQL Server 8.0
5.Go to bin
6.On the top at path,type cmd which will navigate to command prompt
7.In command prompt,
mysql -u root -p
Enter the password which was created while installing the mysql workbench.

How to execute the query in MySQL workbench?

MethodI

select the query and click in the run(flash symbol)

MethodII

select the query and click ctrl+enter

Ex1:

C:\Program Files\MySQL\MySQL Server 8.0\bin>mysql -u root -p


Enter password: *********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 16
Server version: 8.0.37 MySQL Community Server - GPL

Copyright (c) 2000, 2024, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its


affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;


+--------------------+
| Database |
+--------------------+
| hyderabad |
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
5 rows in set (0.00 sec)

mysql> use hyderabad;


Database changed
mysql> desc locations;
+----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| Sno | int | YES | | NULL | |
| Name | varchar(30) | YES | | NULL | |
| Distance | float | YES | | NULL | |
+----------+-------------+------+-----+---------+-------+
3 rows in set (0.00 sec)

mysql> insert into locations values(1,"Golconda",11.12);


Query OK, 1 row affected (0.01 sec)

mysql> select * from locations;


+------+----------+----------+
| Sno | Name | Distance |
+------+----------+----------+
| 1 | Golconda | 11.12 |
+------+----------+----------+
1 row in set (0.00 sec)

Significane of ; in every query:

Semi-colon(;) is used to end the query without any other querying.The mysql engine
only exeutes the query whenever it is ends with the semi-colon and recognizes as
the end of the statement.

You might also like