Mysql Tutorial: What Is Dbms
Mysql Tutorial: What Is Dbms
What is DBMS
What is DBMS – DBMS or Database Management System is a
collection of programs which enable user to access database,
manipulate data and represent data. A technology to store and
retrieve data with utmost efficiency along with appropriate
security measures.
Attributes
Composite Attributes:
COMPOSITE VS SIMPLE: Composite
Attributes are attributes that can
be divided into several sub-
attributes. Simple Attributes are
those attributes that cannot be
divided into sub parts.
SINGLE VALUED VS MULTI-VALUED:
Single value like Number and Name
under the DEPARTMENT entity,
describes that the department has only one name and one number.
Location is a multi-valued attribute because department can be
located into several areas.
COMPLEX ATTRIBUTE: This is a group of composite attributes such
as Phone (area code + phone number) and Address (number + street
+ town/city).
Type of Keys
PRIMARY KEY AND FOREIGN KEY
DATABASE NORMALIZATION IS USED TO REDUCE REDUNDANCY OR DATA
ANOMALIES
Data Types
Constraints
Data Manipulation
Create Database
Go to MySQL Workbench
Create New Connection and give it a name
Click Store in Vault and enter your MySQL Password
Check Connection
Click OK
Select your newly created Connection, until directed to the
GUI
Click Create new schema (scheme literally means database)
We can copy the query code generated from our first database
and paste it on the new SQL File and rename it with a new
database name. In our case, we renamed it as CREATE SCHEMA
`DBYee2` ;
Execute the new query by hitting the thunder bolt sign on the
GUI. A check indicator will appear on the console signifies
that a new database has been create. Refresh the scheme on the
Object Browser, and a new database will appear.
Create Table
To create Table,
Click the arrow beside the database name, and right click on
Table.
Name the table
Create Column
Click the double arrow at the top right corner of the window
to reduce the display
Double click the empty box under the Column Name Tab, and it
will automatically generate a column name.
Primary Key
The first column is normally the “primary key” (PK), and what is
primary key? This is the column of unique identities of a data.
The data inside the primary key column doesn’t have any duplicate
or similarities, thus it serves as the unique identification of a
person included in the database.
Data Type
We have plenty of data types in MySQL and can be shown in the
dropdown:
For strings, we can use the data type VARCHAR and the default
number of character is 45, but for any numerical data we have to
use the INT type (integer).
Once we clicked the Apply button after we set up all the details
of the columns of our first table, the system will generate a new
set of codes or queries. This is the SQL code for the entire
first table.
:
CREATE TABLE `dbyee`.`EmployeeInfo` (
Again, Refresh the Object Browser and check if a new table has
been created under the database.
Right click the table icon and select Edit Table to check the
table structure on the GUI
Note, to create a new table, you can also use the query code
above. Just edit the input data and apply the query. Then execute
using the thunderbolt icon.
Show Command
To show all the list of the databases in the connection, type:
show databases;
Use Command
To switch into or to select the database you want to use, use the
use command. For example:
use `dbyee`;
Drop Command
To leave the database, use the command “drop database
`NameofTheDatabase`;
Example:
drop database `dbyee`;
Insert Command
To insert data into the database, use the follow sample syntax:
insert into `db_yee`.`studentinfo`
(`studentID`, `studentFN`, `studentLN`, `Age`)
VALUES
('0002','RUBEN','SARMIENTO','19');
To input some data that into the table (without completing all
the columns)
Select Command
This command displays the content of a table. The command to use
if we want to see the entire content of a table is:
select * from studentinfo; // where studentinfo is the name of the
table.
https://www.youtube.com/watch?
v=cfY9BkYdAh0&list=PLS1QulWo1RIY4auvfxAHS9m_fZJ2wxSse&index=10
youtube.com/watch?
v=Iaj3jm2pC0Q&list=PLS1QulWo1RIahlYDqHWZb81qsKgEvPiHn&index=3