dbms_240902_194637
dbms_240902_194637
Download MySQL:
Step 1: Go to the official website of MySQL and download the community server
edition software. Here, 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. If you have good internet
connectivity, then choose the mysql-installer-web-community. Otherwise, choose the
other one.
Installation of MySQL:
Step 1: After downloading the setup, unzip it anywhere and double click the
MSI installer .exe file. It will give the following screen:
Step 2: In the next wizard, choose the Setup Type. There are several types available,
and we need to choose the appropriate option to install MySQL product and features.
Select the Full option and click on the Next button.
This option will install the following things: MySQL Server, MySQL Shell, MySQL
Router, MySQL Workbench, MySQL Connectors, documentation, samples and
examples, and many more.
Step 3: Once we click on the Next button, it may give information about some
features that may fail to install on your system due to a lack of requirements. We can
resolve them by clicking on the Execute button that will install all requirements
automatically or can skip them. Now, click on the Next button.
Step 4: In the next wizard, we will see a dialog box that asks for our confirmation of a
few products not getting installed. Here, we have to click on the Yes button.
After clicking on the Yes button, we will see the list of the products which are going
to be installed. click on the Execute button.
Step 5: Once we click on the Execute button, it will download and install all the
products. After completing the installation, click on the Next button.
Step 6: In the next wizard, we need to configure the MySQL Server and Router. Here,
I am not going to configure the Router because there is no need to use it with MySQL.
Now, click on the Next button.
Step 7: As soon as you will click on the Next button, you can see the screen below. Here, we
have to configure the MySQL Server. Now, choose the Standalone MySQL Server/Classic
MySQL Replication option and click on Next.
Step 8: 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 Machine'
and Connectivity as TCP/IP, and Port Number is 3306, then click on Next.
Step 9: Now, select the Authentication Method and click on Next. Here, I am going to select
the first option.
Step 10: The next screen will ask you to mention the MySQL Root Password. After
filling the password details, click on the Next button.
Step 11: 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.
Step 12: 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 13: Once the configuration has completed, we will get the screen below. Click
on the Finish button to continue.
Step 14: In the next screen, you can see that the Product Configuration is completed.
Keep the default setting and click on the Next-> Finish button to complete the
MySQL package installation.
Step 15: In the next wizard, we can choose to configure the Router. So click on Next-
>Finish and then click the Next button.
Step 16: 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.
In this screen, it is also required to check about the connection is successful or not by
clicking on the Check button. If the connection is successful, click on the Execute
button. Now, the configuration is complete, click on Next.
Step 17: In the next wizard, select the applied configurations and click on the Execute
button.
Step 18: After completing the above step, we will get the following screen. Here,
click on the Finish button.
Step 19: Now, the MySQL installation is complete. Click on the Finish
button.
Verification of MySQL:
Open your MySQL Command Line Client; it should have appeared with a mysql>
prompt. If you have set any password, write password here. Now,we are connected to
the MySQL server, and can execute all the SQL command at mysql> prompt as
follows:
For example: Check the already created databases with show databases command:
Experiment - 2
1. Numeric Types:
INT: Integer values (whole numbers) without decimals.
FLOAT/REAL:Approximate numeric values for floating-point numbers.
DECIMAL/NUMERIC: Exact numeric values for fixed-point numbers.
5. Boolean Type:
BOOLEAN: Stores true or false values (represented as 1 or 0).
1. Tables: A table is a collection of rows and columns used to store data.Tables are
the primary objects in a relational database.
2. Views: A view is a virtual table based on the result of a SQL query.It doesn't
store data physically but provides a way to simplify complex queries and control
access to specific data.
6. Sequence: A sequence generates unique numeric values, often used for creating
unique indentifiers for rows in tables.
1. Create command:
a. Creating Database:
Code:
Create database studentdb;
Output:
b. Creating Table:
Code:
Create table student (Id int not null , Name varchar(15), Department char
(8) ,Address varchar(100),Primary key(Id));
Output:
2. Alter command:
a. To add column:
Code:
Alter table student add email varchar(150);
Output:
b. To drop column:
Code:
Alter table student drop column email;
Output:
c. To rename column:
Code:
Alter table student rename column Name to Full_Name;
Output:
d. To modify datatype:
Code:
Alter table student modify column Id decimal(18,4);
Output:
3. Drop command:
Code:
Drop table student;
Output:
4. Truncate command:
Code:
Truncate table student;
Output: