SlideShare a Scribd company logo
1 of 33
Download to read offline
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 1
Task-1
Introduction and Installation of MySQL.
MySQL is an open-source relational database management system (RDBMS). Its name is a
combination of "My", the name of co-founder Michael Widenius's daughter My, and "SQL",
the acronym for Structured Query Language. A relational database organizes data into one or
more data tables in which data may be related to each other; these relations help structure the
data. SQL is a language that programmers use to create, modify and extract data from the
relational database, as well as control user access to the database. In addition to relational
databases and SQL, an RDBMS like MySQL works with an operating system to implement a
relational database in a computer's storage system, manages users, allows for network access
and facilitates testing database integrity and creation of backups.
MySQL is free and open-source software under the terms of the GNU General Public License,
and is also available under a variety of proprietary licenses. MySQL was owned and sponsored
by the Swedish company MySQL AB, which was bought by Sun Microsystems (now Oracle
Corporation). In 2010, when Oracle acquired Sun, Widenius forked the open-source MySQL
project to create MariaDB.
Downloading and Installing MySQL on Windows:
Step 1: Go to the official website of MySQL and download the community server edition
software. Here, you will see the option to choose the Operating System, such as Windows.
Step 2: Next, there are two options available to download the setup. Choose the version number
for the MySQL community server, which you want. If you have good internet connectivity,
then choose the mysql-installer-web-community. Otherwise, choose the other one.
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 2
Step 3: Now open the MSI installer .exe file. It will give the following screen:
Step 4: In the next wizard, choose the Setup Type. There are several types available, and you
need to choose the appropriate option to install MySQL product and features. Here, we are
going to select the Full option and click on the Next button.
Step 5: After selecting the full setup type and clicking on Next we will get this interface where
we can see what we are gonna get in the full setup of sql server. As we can see in the image
below that we are getting myql server 8.0.34, workbench 8.0.34, Shell 8.0.34, router 8.0.34,
Documentation 8.0.34, samples and examples 8.0.34
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 3
Step 6: In this step we get the product configuration like MySQL server 8.0.34, MySQL router
8.0.34, Samples and examples 8.0.34.
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 4
Step 7: In the next screen, the system will ask you to choose the Config Type and other
connectivity options. Here, we are going to select the Config Type as 'Development Computer'
and Connectivity as TCP/IP, Port Number as 3306, and X Protocol Port as 33060, then click
on Next.
Step 8: Now, select the Authentication Method and click on Next.
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 5
Step 9: The next screen will ask you to mention the MySQL Root Password. After filling the
password details, click on the Next button.
Step 10: The next screen will ask you to configure the Windows Service to start the server.
Keep the default setup and click on the Next button.
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 6
Step 11: In the next wizard, the system will ask you to apply the Server Configuration. If you
agree with this configuration, click on the Execute button.
Step 12: Once the configuration is completed, we will get to Router Configuration. Now, click
on the Finish button to continue.
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 7
Step 13: In the next wizard, we will see the Connect to Server option. Here, we have to mention
the root password, which we had set in the previous steps and click on Next.
Step 14: In the next wizard, select the applied configurations and click on the Execute button.
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 8
Step 15: After completing the above step, we will get the following screen. Here, click on the
Finish button.
Step 16: Now, the MySQL installation is complete. Click on the Finish button.
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 9
Step 17: Now it automatically opens the shell and MySQL Workbench.
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 10
Task- 2
Data Types, Creating Tables, Retrieval of Rows using Select Statement,
Conditional Retrieval of Rows, Alter and Drop Statements.
DATATYPES:
The data type of a column can be defined as basically what type of data format in which
each cell will store the data – it can be any type of integer, character, money, date and time,
binary, etc. In this article, we’ll get to learn about SQL Data Types in detail.
SQL Data Types
An SQL developer must aware of what type of data will be stored inside each column while
creating a table. The data type guideline for SQL is to understand what type of data is
expected inside each column and it also identifies how SQL will interact with the stored
data.
SQL (Structured Query Language) is a language used to interact with relational databases.
SQL data types define the type of data that can be stored in a database column or variable.
Here are the most common SQL data types:
Data Type Properties
Numeric data
types
These are used to store numeric values. Examples include INT,
BIGINT , DECIMAL, and FLOAT.
Character data
types
These are used to store character strings. Examples include CHAR,
VARCHAR, and TEXT.
Date and time
data types
These are used to store date and time values. Examples include
DATE , TIME, and TIMESTAMP
Binary data types
These are used to store binary data, such as images or audio files.
Examples include BLOB and BYTEA.
Boolean data
type
This data type is used to store logical values. The only possible values are
TRUE and FALSE.
Interval data
types
These are used to store intervals of time. Examples include INTERVAL
YEAR, INTERVAL MONTH, and INTERVAL DAY.
Array data types
These are used to store arrays of values. Examples include ARRAY and
JSON.
XML data type This data type is used to store XML data.
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 11
Data Type Properties
Spatial data types
These are used to store geometric or geographic data. Examples include
POINT, LINE, and POLYGON.
SHOW DATABASE:
Description: This statement is used to lists the databases on the MySQL server host.
Syntax: show databases;
CREATE DATABASE:
Description: This statement is used to create a new SQL database.
Syntax: create database database_name;
USE DATABASE:
Description: This statement tells MySQL to use the named database as the default (current)
database for subsequent statements.
Syntax: use database_name;
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 12
DROP DATABASE:
Description: This statement is used to drop an existing SQL database.
Syntax: drop database database_name;
CREATE TABLE:
Description: This statement is used to create a new table in a database.
Syntax: create table table_name (column1_name datatype, column2_name datatype);
SHOW TABLE:
Description: This statement lists all the tables in the current database.
Syntax: show tables;
INSERT VALUE INTO TABLE:
Description: This statement is used to insert values into the tables in database.
Syntax: insert into table_name values(value1, value2);
For multiple values: insert into table_name values(value1, value2),(value3, value4);
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 13
SELECT :
Description: This statement is used to select data from a database.
Syntax: select column_name from table_name;
For selecting all columns: select * from table_name;
DESCRIBE:
Description: This statement is used to show the structure of a table.
Syntax: describe table_name;
ALTER TABLE:
Description: This statement is used to add, delete, or modify columns in an existing table.
To ADD Syntax: alter table table_name add column_name datatype;
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 14
To DELETE Syntax: alter table table_name drop column_name;
To RENAME Table Syntax: alter table table_name rename to new_table_name;
To RENAME Column Syntax: alter table table_name rename column old_column_name to
new_column_name;
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 15
TASK – 3
Working with null values, Matching a pattern from table, Ordering the result of
a query, Aggregate function, Grouping the result of a query, Update and Delete
statement
Customer Attributes : ID (Primary Key), Name (Not Null), Address, Email ID, Age,
Salary
Matching a pattern from table:
1) Display customer id and name where salary is not null
2) Display the customer detail where the salary is null
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 16
3) Display the customer detail whose name starts with ‘ab’
4) Display the customer detail where ‘gf’ is a substring in a name
5) Display customer id, name, salary where the name ended with ‘d’
6) Display the customer detail where age number starts with ‘2’
7) Display customer id and name whose salary contain ‘30’ in between
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 17
8) Display customer detail whose name starts with ‘b’ end with ‘d’
9) Display id, name and salary where name contains ‘f’ at third position
Update Statement:
Syntax: update tabe_name set column_name = value where column_name like pattern;
1) Update customer salary to 30000 where age is less than 20
2) Update customer salary to 40000 where names are starting with ‘ab’
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 18
Like Operator with Delete Statement:
Syntax: delete from table_name where colum_name like pattern;
1) Remove customer detail whose name contains letter ‘c’ at any index
2) Delete customer details who are having age less than 20
Ordering the result of query:
Syntax: select column1, column2,… from table_name order by column1, column2,…
asc/desc;
1) Display name and salaries of all the customers based on decreasing order of their salary
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 19
2) Display customer id and name as per increasing order of customer id
3) Display id, name and salary based on increasing order of id and salary should be further
arranged in highest to lowest order
Employee Attributes : ID, Name, Salary, Job, Hire_Date, Age
4) Display name ,salary and job of employee who are working as a manager in highest to
lowest order by salary
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 20
5) Display name, hire date and annual salary of all the employees based on highest to lowest
Aggregate Functions :
1) Count
2) Sum
3) Average
4) Minimum
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 21
5) Maximum
Grouping the result of a query:
Syntax: select column1, function_name(column2) from table_name where condition group by
column1, column2 ;
1) Select name and salary of employees where the age is greater than 18 and group by salary
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 22
TASK – 4
Set Operators, Nested Queries, Joins, Sequences.
Set Operators:
Location1 & Location2 Attributes : Name, Roll_No
1) Union
Syntax: select column_name from table1 union select column_name from table2;
2) Union All
Syntax: select column_name from table1 union all select column_name from table2;
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 23
3) Intersect
Syntax: select column_name from table1 intersect select column_name from table2;
Joins:
Student1 Attributes: Roll_No, Name, Address, Phone_No, Age
StudentCourse Attributes: Course_ID, Roll_No
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 24
1) Inner Join
Syntax: select table1.column1, table1.column2, table2.column1, .... from table1 inner join
table2 on table1.matching_column = table2.matching_column;
2) Left Join
Syntax: select table1.column1, table1.column2, table2.column1, .... from table1 left join
table2 on table1.matching_column = table2.matching_column;
3) Right Join
Syntax: select table1.column1, table1.column2, table2.column1, .... from table1 right join
table2 on table1.matching_column = table2.matching_column;
4) Full Join
Syntax: select table1.column1, table1.column2, table2.column1, .... from table1 full join
table2 on table1.matching_column = table2.matching_column;
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 25
5) Natural Join
Syntax: select table1.column1, table1.column2, table2.column1, .... from table1 natural join
table2;
i) Equi Join
Syntax: select column_list from table1, table2.... where table1.column_name =
table2.column_name;
ii) Non Equi Join
Syntax: select * from table_name1, table_name2 where table_name1.column [˂ | ˃ | ≥ | ≤ ]
table_name2.column;
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 26
Sequences:
Syntax: create table table_name ( column1 datatype auto_increment, column2 datatype , ... );
Nested Queries:
Student Attributes: Roll_Number, Name, Section
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 27
Information & Information2 Attributes: Roll_Number, Name, Contact_Number, Location
Syntax: select column_name from table_name where column_name expression operator
(select column_name from table_name where ….);
1) Display name, location, contact no. of the students whose section is ‘a’
2) How to Insert
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 28
3) Delete the students from information2 table whose roll no is same as that in information
table and having location as ‘location7’
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 29
TASK – 5
Views, Indexes, Database Security and Privileges: Grant and Revoke
Commands, Commit and Rollback Commands.
Views:
A view is nothing more than a SQL statement that is stored in the database with an associated
name. A view is actually a composition of a table in the form of a predefined SQL query.
A view can contain all rows of a table or select rows from a table. A view can be created
from one or many tables which depends on the written SQL query to create a view.
Student Attributes : Roll_Number, Section
Information Attributes : Roll_Number, Name, Contact_Number, Location
1) Creating View from a single table
Syntax: create view view_name as select column1, column2, ... from table_name where
condition;
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 30
2) Creating View from multiple tables
Syntax : create view view_name as select table1.column1, table1.column2, ....
,table2.column1, table2.column2, …. from table1, table2 where condition;
3) Deleting Views
Syntax : drop view view_name;
4) Create or Replace Views
Syntax : create or replace view view_name as select column1,coulmn2,.. from table_name
where condition;
5) Delete Rows in Views
Syntax : delete from view_name where condition;
6) Insert into View
Syntax : insert into view_name(column1, column2 , ..) values(value1, value2, ..);
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 31
Index:
Indexes are used to retrieve data from the database more quickly than otherwise. The users
cannot see the indexes, they are just used to speed up searches/queries.
Student Attributes : Id, Name, Age, Address
1) Create and Show Index on a Table
Syntax : create index index_name on table_name (column1, column2, ….) ;
Syntax : show indexes from table_name;
2) Explain Index
Syntax : explain select column1, column2, …. from table_name where condition;
3) Drop Index
Syntax : drop index index_name on table_name;
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 32
Privileges:
A privilege is permission to execute one particular type of SQL statement or access a second
persons’ object. Database privilege controls the use of computing resources. Database
privilege does not apply to the Database administrator of the database.
1) Create a User
Syntax : Create user user_name@localhost identified by ‘password’;
2) Show Privileges
Syntax : show grants for user_name@localhost;
3) Grant All Privileges
Syntax : grant all on database_name.* to user_name@localhost;
3) Revoke All on All Privileges Databases
Syntax : revoke all, grant option from user_name@localhost;
4) Grant Privileges by name
Syntax : grant select,insert,update,delete, …. on database_name.* to user_name@localhost;
DBMS Lab File Name-Abhishek Kumar
BTCS 505-18 Roll no-2124430
P a g e 33
5) Revoke Privileges by name
Syntax : revoke select, insert, update, delete, …. on database_name.* from
user_name@localhost;
Commit and Rollback:
Commit and rollback are the transaction control commands in SQL. All the commands that
are executed consecutively, treated as a single unit of work and termed as a transaction.
St Attributes : Id, Name, Age, Address
1) Start Transaction
Syntax : start transaction;
2) Turn off Auto Commit
Syntax : set autocommit = 0;
3) Commit
Syntax : commit;
4) Rollback
Syntax : rollback;

More Related Content

Similar to DBMS LAB FILE1 task 1 , task 2, task3 and many more.pdf

SQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics CoveredSQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics CoveredDanish Mehraj
 
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdfmysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdfpradnyamulay
 
Based on the materials for this week, create your own unique Datab.docx
Based on the materials for this week, create your own unique Datab.docxBased on the materials for this week, create your own unique Datab.docx
Based on the materials for this week, create your own unique Datab.docxJASS44
 
SQL PPT.pptx
SQL PPT.pptxSQL PPT.pptx
SQL PPT.pptxKulbir4
 
Database queries
Database queriesDatabase queries
Database queriesIIUM
 
Steps for upgrading the database to 10g release 2
Steps for upgrading the database to 10g release 2Steps for upgrading the database to 10g release 2
Steps for upgrading the database to 10g release 2nesmaddy
 
PostgreSQL Database Slides
PostgreSQL Database SlidesPostgreSQL Database Slides
PostgreSQL Database Slidesmetsarin
 
Sql interview question part 12
Sql interview question part 12Sql interview question part 12
Sql interview question part 12kaashiv1
 

Similar to DBMS LAB FILE1 task 1 , task 2, task3 and many more.pdf (20)

SQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics CoveredSQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics Covered
 
SQL
SQLSQL
SQL
 
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdfmysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
 
MySQL and its basic commands
MySQL and its basic commandsMySQL and its basic commands
MySQL and its basic commands
 
Sq lite
Sq liteSq lite
Sq lite
 
Based on the materials for this week, create your own unique Datab.docx
Based on the materials for this week, create your own unique Datab.docxBased on the materials for this week, create your own unique Datab.docx
Based on the materials for this week, create your own unique Datab.docx
 
SQL PPT.pptx
SQL PPT.pptxSQL PPT.pptx
SQL PPT.pptx
 
Sql project ..
Sql project ..Sql project ..
Sql project ..
 
Postgresql
PostgresqlPostgresql
Postgresql
 
create database.pptx
create database.pptxcreate database.pptx
create database.pptx
 
7. SQL.pptx
7. SQL.pptx7. SQL.pptx
7. SQL.pptx
 
My sql.ppt
My sql.pptMy sql.ppt
My sql.ppt
 
Database queries
Database queriesDatabase queries
Database queries
 
MYSQL.ppt
MYSQL.pptMYSQL.ppt
MYSQL.ppt
 
Steps for upgrading the database to 10g release 2
Steps for upgrading the database to 10g release 2Steps for upgrading the database to 10g release 2
Steps for upgrading the database to 10g release 2
 
PostgreSQL Database Slides
PostgreSQL Database SlidesPostgreSQL Database Slides
PostgreSQL Database Slides
 
LECTURE NOTES.pdf
LECTURE NOTES.pdfLECTURE NOTES.pdf
LECTURE NOTES.pdf
 
LECTURE NOTES.pdf
LECTURE NOTES.pdfLECTURE NOTES.pdf
LECTURE NOTES.pdf
 
Sql interview question part 12
Sql interview question part 12Sql interview question part 12
Sql interview question part 12
 
Ebook12
Ebook12Ebook12
Ebook12
 

Recently uploaded

HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 

Recently uploaded (20)

HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 

DBMS LAB FILE1 task 1 , task 2, task3 and many more.pdf

  • 1. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 1 Task-1 Introduction and Installation of MySQL. MySQL is an open-source relational database management system (RDBMS). Its name is a combination of "My", the name of co-founder Michael Widenius's daughter My, and "SQL", the acronym for Structured Query Language. A relational database organizes data into one or more data tables in which data may be related to each other; these relations help structure the data. SQL is a language that programmers use to create, modify and extract data from the relational database, as well as control user access to the database. In addition to relational databases and SQL, an RDBMS like MySQL works with an operating system to implement a relational database in a computer's storage system, manages users, allows for network access and facilitates testing database integrity and creation of backups. MySQL is free and open-source software under the terms of the GNU General Public License, and is also available under a variety of proprietary licenses. MySQL was owned and sponsored by the Swedish company MySQL AB, which was bought by Sun Microsystems (now Oracle Corporation). In 2010, when Oracle acquired Sun, Widenius forked the open-source MySQL project to create MariaDB. Downloading and Installing MySQL on Windows: Step 1: Go to the official website of MySQL and download the community server edition software. Here, you will see the option to choose the Operating System, such as Windows. Step 2: Next, there are two options available to download the setup. Choose the version number for the MySQL community server, which you want. If you have good internet connectivity, then choose the mysql-installer-web-community. Otherwise, choose the other one.
  • 2. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 2 Step 3: Now open the MSI installer .exe file. It will give the following screen: Step 4: In the next wizard, choose the Setup Type. There are several types available, and you need to choose the appropriate option to install MySQL product and features. Here, we are going to select the Full option and click on the Next button. Step 5: After selecting the full setup type and clicking on Next we will get this interface where we can see what we are gonna get in the full setup of sql server. As we can see in the image below that we are getting myql server 8.0.34, workbench 8.0.34, Shell 8.0.34, router 8.0.34, Documentation 8.0.34, samples and examples 8.0.34
  • 3. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 3 Step 6: In this step we get the product configuration like MySQL server 8.0.34, MySQL router 8.0.34, Samples and examples 8.0.34.
  • 4. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 4 Step 7: In the next screen, the system will ask you to choose the Config Type and other connectivity options. Here, we are going to select the Config Type as 'Development Computer' and Connectivity as TCP/IP, Port Number as 3306, and X Protocol Port as 33060, then click on Next. Step 8: Now, select the Authentication Method and click on Next.
  • 5. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 5 Step 9: The next screen will ask you to mention the MySQL Root Password. After filling the password details, click on the Next button. Step 10: The next screen will ask you to configure the Windows Service to start the server. Keep the default setup and click on the Next button.
  • 6. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 6 Step 11: In the next wizard, the system will ask you to apply the Server Configuration. If you agree with this configuration, click on the Execute button. Step 12: Once the configuration is completed, we will get to Router Configuration. Now, click on the Finish button to continue.
  • 7. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 7 Step 13: In the next wizard, we will see the Connect to Server option. Here, we have to mention the root password, which we had set in the previous steps and click on Next. Step 14: In the next wizard, select the applied configurations and click on the Execute button.
  • 8. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 8 Step 15: After completing the above step, we will get the following screen. Here, click on the Finish button. Step 16: Now, the MySQL installation is complete. Click on the Finish button.
  • 9. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 9 Step 17: Now it automatically opens the shell and MySQL Workbench.
  • 10. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 10 Task- 2 Data Types, Creating Tables, Retrieval of Rows using Select Statement, Conditional Retrieval of Rows, Alter and Drop Statements. DATATYPES: The data type of a column can be defined as basically what type of data format in which each cell will store the data – it can be any type of integer, character, money, date and time, binary, etc. In this article, we’ll get to learn about SQL Data Types in detail. SQL Data Types An SQL developer must aware of what type of data will be stored inside each column while creating a table. The data type guideline for SQL is to understand what type of data is expected inside each column and it also identifies how SQL will interact with the stored data. SQL (Structured Query Language) is a language used to interact with relational databases. SQL data types define the type of data that can be stored in a database column or variable. Here are the most common SQL data types: Data Type Properties Numeric data types These are used to store numeric values. Examples include INT, BIGINT , DECIMAL, and FLOAT. Character data types These are used to store character strings. Examples include CHAR, VARCHAR, and TEXT. Date and time data types These are used to store date and time values. Examples include DATE , TIME, and TIMESTAMP Binary data types These are used to store binary data, such as images or audio files. Examples include BLOB and BYTEA. Boolean data type This data type is used to store logical values. The only possible values are TRUE and FALSE. Interval data types These are used to store intervals of time. Examples include INTERVAL YEAR, INTERVAL MONTH, and INTERVAL DAY. Array data types These are used to store arrays of values. Examples include ARRAY and JSON. XML data type This data type is used to store XML data.
  • 11. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 11 Data Type Properties Spatial data types These are used to store geometric or geographic data. Examples include POINT, LINE, and POLYGON. SHOW DATABASE: Description: This statement is used to lists the databases on the MySQL server host. Syntax: show databases; CREATE DATABASE: Description: This statement is used to create a new SQL database. Syntax: create database database_name; USE DATABASE: Description: This statement tells MySQL to use the named database as the default (current) database for subsequent statements. Syntax: use database_name;
  • 12. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 12 DROP DATABASE: Description: This statement is used to drop an existing SQL database. Syntax: drop database database_name; CREATE TABLE: Description: This statement is used to create a new table in a database. Syntax: create table table_name (column1_name datatype, column2_name datatype); SHOW TABLE: Description: This statement lists all the tables in the current database. Syntax: show tables; INSERT VALUE INTO TABLE: Description: This statement is used to insert values into the tables in database. Syntax: insert into table_name values(value1, value2); For multiple values: insert into table_name values(value1, value2),(value3, value4);
  • 13. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 13 SELECT : Description: This statement is used to select data from a database. Syntax: select column_name from table_name; For selecting all columns: select * from table_name; DESCRIBE: Description: This statement is used to show the structure of a table. Syntax: describe table_name; ALTER TABLE: Description: This statement is used to add, delete, or modify columns in an existing table. To ADD Syntax: alter table table_name add column_name datatype;
  • 14. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 14 To DELETE Syntax: alter table table_name drop column_name; To RENAME Table Syntax: alter table table_name rename to new_table_name; To RENAME Column Syntax: alter table table_name rename column old_column_name to new_column_name;
  • 15. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 15 TASK – 3 Working with null values, Matching a pattern from table, Ordering the result of a query, Aggregate function, Grouping the result of a query, Update and Delete statement Customer Attributes : ID (Primary Key), Name (Not Null), Address, Email ID, Age, Salary Matching a pattern from table: 1) Display customer id and name where salary is not null 2) Display the customer detail where the salary is null
  • 16. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 16 3) Display the customer detail whose name starts with ‘ab’ 4) Display the customer detail where ‘gf’ is a substring in a name 5) Display customer id, name, salary where the name ended with ‘d’ 6) Display the customer detail where age number starts with ‘2’ 7) Display customer id and name whose salary contain ‘30’ in between
  • 17. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 17 8) Display customer detail whose name starts with ‘b’ end with ‘d’ 9) Display id, name and salary where name contains ‘f’ at third position Update Statement: Syntax: update tabe_name set column_name = value where column_name like pattern; 1) Update customer salary to 30000 where age is less than 20 2) Update customer salary to 40000 where names are starting with ‘ab’
  • 18. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 18 Like Operator with Delete Statement: Syntax: delete from table_name where colum_name like pattern; 1) Remove customer detail whose name contains letter ‘c’ at any index 2) Delete customer details who are having age less than 20 Ordering the result of query: Syntax: select column1, column2,… from table_name order by column1, column2,… asc/desc; 1) Display name and salaries of all the customers based on decreasing order of their salary
  • 19. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 19 2) Display customer id and name as per increasing order of customer id 3) Display id, name and salary based on increasing order of id and salary should be further arranged in highest to lowest order Employee Attributes : ID, Name, Salary, Job, Hire_Date, Age 4) Display name ,salary and job of employee who are working as a manager in highest to lowest order by salary
  • 20. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 20 5) Display name, hire date and annual salary of all the employees based on highest to lowest Aggregate Functions : 1) Count 2) Sum 3) Average 4) Minimum
  • 21. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 21 5) Maximum Grouping the result of a query: Syntax: select column1, function_name(column2) from table_name where condition group by column1, column2 ; 1) Select name and salary of employees where the age is greater than 18 and group by salary
  • 22. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 22 TASK – 4 Set Operators, Nested Queries, Joins, Sequences. Set Operators: Location1 & Location2 Attributes : Name, Roll_No 1) Union Syntax: select column_name from table1 union select column_name from table2; 2) Union All Syntax: select column_name from table1 union all select column_name from table2;
  • 23. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 23 3) Intersect Syntax: select column_name from table1 intersect select column_name from table2; Joins: Student1 Attributes: Roll_No, Name, Address, Phone_No, Age StudentCourse Attributes: Course_ID, Roll_No
  • 24. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 24 1) Inner Join Syntax: select table1.column1, table1.column2, table2.column1, .... from table1 inner join table2 on table1.matching_column = table2.matching_column; 2) Left Join Syntax: select table1.column1, table1.column2, table2.column1, .... from table1 left join table2 on table1.matching_column = table2.matching_column; 3) Right Join Syntax: select table1.column1, table1.column2, table2.column1, .... from table1 right join table2 on table1.matching_column = table2.matching_column; 4) Full Join Syntax: select table1.column1, table1.column2, table2.column1, .... from table1 full join table2 on table1.matching_column = table2.matching_column;
  • 25. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 25 5) Natural Join Syntax: select table1.column1, table1.column2, table2.column1, .... from table1 natural join table2; i) Equi Join Syntax: select column_list from table1, table2.... where table1.column_name = table2.column_name; ii) Non Equi Join Syntax: select * from table_name1, table_name2 where table_name1.column [˂ | ˃ | ≥ | ≤ ] table_name2.column;
  • 26. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 26 Sequences: Syntax: create table table_name ( column1 datatype auto_increment, column2 datatype , ... ); Nested Queries: Student Attributes: Roll_Number, Name, Section
  • 27. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 27 Information & Information2 Attributes: Roll_Number, Name, Contact_Number, Location Syntax: select column_name from table_name where column_name expression operator (select column_name from table_name where ….); 1) Display name, location, contact no. of the students whose section is ‘a’ 2) How to Insert
  • 28. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 28 3) Delete the students from information2 table whose roll no is same as that in information table and having location as ‘location7’
  • 29. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 29 TASK – 5 Views, Indexes, Database Security and Privileges: Grant and Revoke Commands, Commit and Rollback Commands. Views: A view is nothing more than a SQL statement that is stored in the database with an associated name. A view is actually a composition of a table in the form of a predefined SQL query. A view can contain all rows of a table or select rows from a table. A view can be created from one or many tables which depends on the written SQL query to create a view. Student Attributes : Roll_Number, Section Information Attributes : Roll_Number, Name, Contact_Number, Location 1) Creating View from a single table Syntax: create view view_name as select column1, column2, ... from table_name where condition;
  • 30. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 30 2) Creating View from multiple tables Syntax : create view view_name as select table1.column1, table1.column2, .... ,table2.column1, table2.column2, …. from table1, table2 where condition; 3) Deleting Views Syntax : drop view view_name; 4) Create or Replace Views Syntax : create or replace view view_name as select column1,coulmn2,.. from table_name where condition; 5) Delete Rows in Views Syntax : delete from view_name where condition; 6) Insert into View Syntax : insert into view_name(column1, column2 , ..) values(value1, value2, ..);
  • 31. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 31 Index: Indexes are used to retrieve data from the database more quickly than otherwise. The users cannot see the indexes, they are just used to speed up searches/queries. Student Attributes : Id, Name, Age, Address 1) Create and Show Index on a Table Syntax : create index index_name on table_name (column1, column2, ….) ; Syntax : show indexes from table_name; 2) Explain Index Syntax : explain select column1, column2, …. from table_name where condition; 3) Drop Index Syntax : drop index index_name on table_name;
  • 32. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 32 Privileges: A privilege is permission to execute one particular type of SQL statement or access a second persons’ object. Database privilege controls the use of computing resources. Database privilege does not apply to the Database administrator of the database. 1) Create a User Syntax : Create user user_name@localhost identified by ‘password’; 2) Show Privileges Syntax : show grants for user_name@localhost; 3) Grant All Privileges Syntax : grant all on database_name.* to user_name@localhost; 3) Revoke All on All Privileges Databases Syntax : revoke all, grant option from user_name@localhost; 4) Grant Privileges by name Syntax : grant select,insert,update,delete, …. on database_name.* to user_name@localhost;
  • 33. DBMS Lab File Name-Abhishek Kumar BTCS 505-18 Roll no-2124430 P a g e 33 5) Revoke Privileges by name Syntax : revoke select, insert, update, delete, …. on database_name.* from user_name@localhost; Commit and Rollback: Commit and rollback are the transaction control commands in SQL. All the commands that are executed consecutively, treated as a single unit of work and termed as a transaction. St Attributes : Id, Name, Age, Address 1) Start Transaction Syntax : start transaction; 2) Turn off Auto Commit Syntax : set autocommit = 0; 3) Commit Syntax : commit; 4) Rollback Syntax : rollback;