DATABASE & SQL
DATABASE & SQL
DIT — Part II
Professionally Formatted Study Notes
Designed for classroom teaching, revision and practical SQL learning.
Table of Contents
Headings are structured so the TOC can be updated from References → Table of Contents.
Table of Contents
(DBMS database management system). 6
Importance/Advantages of Databases 6
Types of Database Users in DBMS: 7
DBA (Database Administrator) 8
Concurrent Access and Scalability. 8
Data Consistency and Atomicity. 8
Data Analysis and Reporting: 8
Relational DataBase Management System (RDBMS) 9
Introduction to Data Modeling and its importance : 14
Entity Relationship Diagram (ERD) 15
Elements/ components of an ERD include: 15
Transforming an Entity Relationship Diagram (ERD) into a relational schema. 15
Normalization , First Normal Form , second Normal Form , third Normal Form.. 16
Connect to MySQL Using mysql command-line client 18
Connect to MySQL Using MySQL Workbench. 19
Different types of MYSQL statements /commands 23
1.Data Definition Language (DDL) Statements: 24
2. DML stands for Data Manipulation Language. 26
Data Control Language (DCL) 28
Transaction control statements TCL. 29
Data administration statements 30
The MySQL AND, OR and NOT Operators 30
The MySQL ORDER BY Keyword. 31
ORDER BY Several Columns Example. 32
1.2 Importance/Advantages of Databases
1.3 Database Models
1.3.1 Hierarchical
1.3.2 Network
1.3.3 Relational
1.4 Definition of Database Management System (DBMS)
1.4.1 Relational DBMS (SQL Based)
(MS Access, MS SQL, MySQL, ORACLE)
1.4.2 Non-Relational DBMS (NoSQL)
(MongoDB, HBase, Cassandra)
INTRODUCTION TO DATABASE CONCEPTS
4.3.2 Basic Data Types
i. TEXT
ii. LONGTEXT
iii. INT
iv. BIGINT
v. FLOAT
vi. DOUBLE
vii. BOOL
viii. DATE
ix. TIME
x. YEAR
4.3.3 Table Manipulation
i. SHOW TABLE Statement
ii. CREATE TABLE statement
iii. DROP TABLE statement
iv. TRUNCATE TABLE statement
v. ALTER TABLE statement
vi. ALTER TABLE – ADD
vii. ALTER TABLE – DROP COLUMN
viii. ALTER TABLE – MODIFY COLUMN
ix. CREATE INDEX statement
x. INSERT INTO statement
xi. UPDATE statement
xii. DELETE statement
xiii. LIMIT clause
xiv. INSERT INTO SELECT statement
xv. DESC and EXPLAIN statements
4.3.4 Data Retrieval
i. SELECT statement
ii. SELECT DISTINCT statement
iii. WHERE clause
iv. Operators used in WHERE clause
v. Wildcards ( % , _ ) used in WHERE clause
vi. AND, OR, NOT Operators
vii. ORDER BY clause
viii. ORDER BY DESC
ix. GROUP BY statement
x. HAVING clause
4.3.5 Constraints
i. NOT NULL
ii. UNIQUE
iii. PRIMARY KEY
iv. FOREIGN KEY
v. DEFAULT
vi. CHECK
4.3.6 Functions
i. AVG()
ii. COUNT()
iii. CONCAT()
| KP BT&CE DIT Curriculum Revised 2022
[32]
iv. LOWER()
v. LENGTH()
vi. LTRIM()
vii. MIN()
viii. MAX()
ix. RTRIM()
x. REPLACE()
xi. REPEAT()
xii. STRCMP()
xiii. SUBSTR()
xiv. SUM()
xv. UPPER()
4.3.7 MySQL Operators
i. Arithmetic Operators
ii. Comparison Operators
iii. Logical Operators
4.3.8 Views
i. CREATE VIEW statement
ii. DROP VIEW statement
4.3.9 MySQL Joins
i. INNER JOIN
ii. LEFT JOIN
iii. RIGHT JOIN
iv. CROSS JOIN
MySQL NULL Values - IS NULL and IS NOT NULL (w3schools.com)
What is a Database?
A database is a separate application that stores a collection of data in a central location. A database is an integrated repository of an organization's data containing a series of interrelated data sets. Each database has one or more different APIs (application programming interface, is a set of defined rules that enable different applications to communicate with each other. ) for creating, accessing, managing, searching and replicating the data it holds.
Nowadays, we use relational database management systems (RDBMS) to store and manage huge volume of data. This is called relational database because all the data is stored into different tables and relations are established using primary keys or other keys known as Foreign Keys.
DBMS A database management system is the software system that allows users to define, create and maintain a database and provides controlled access to the data.
A Database Management System (DBMS) is basically a collection of programs that enables users to store, modify, and extract information from a database as per the requirements.
DBMS is an intermediate layer between programs and the data. Programs access the DBMS, which then accesses the data.
A database typically requires a comprehensive database software program known as a database management system (DBMS). A DBMS serves as an interface between the database and its end users or programs, allowing users to retrieve, update, and manage how the information is organized and optimized. A DBMS also facilitates oversight and control of databases, enabling a variety of administrative operations such as performance monitoring, tuning, and backup and recovery.
Some examples of popular database software or DBMSs include MySQL, Microsoft Access, Microsoft SQL Server, FileMaker Pro, Oracle Database, and dBASE.
Databases play a crucial role in modern computing and information management for numerous reasons. Here are some of the key importance and advantages of databases:
Data Organization: Databases provide a structured way to organize and store data. They allow for efficient storage and retrieval of information, making it easier to manage large volumes of data.
Data Integrity: Databases enforce data integrity by providing mechanisms such as constraints, validations, and relationships between data elements. This ensures that the data stored remains accurate and consistent over time.
Data Security: Databases offer security features such as access control, encryption, and auditing to protect sensitive information from unauthorized access, tampering, or loss.
Data Consistency: With databases, changes to data can be managed centrally and propagated consistently across the system, ensuring that all users see the same data at any given time.
Concurrency Control: Databases support concurrent access by multiple users or applications while maintaining data consistency. Techniques such as locking and transaction isolation ensure that concurrent operations do not interfere with each other.
Data Recovery: Databases provide features for backup and recovery, allowing organizations to recover data in case of hardware failures, software errors, or other disasters.
Scalability: Databases can scale vertically (adding more resources to a single server) or horizontally (distributing data across multiple servers) to accommodate growing volumes of data and increasing numbers of users.
Querying and Analysis: Databases offer powerful query languages and tools for analyzing data, enabling users to extract insights, generate reports, and make data-driven decisions.
Data Integration: Databases support integration with other systems and applications through standardized interfaces such as APIs, allowing data to be shared and synchronized across different parts of an organization.
Regulatory Compliance: Databases help organizations comply with regulatory requirements by providing features for data governance, audit trails, and compliance reporting.
Collaboration: Databases facilitate collaboration among users by providing features for sharing and collaborating on data, such as concurrent access control, versioning, and data sharing capabilities.
Application Development: Databases serve as the backend for many applications, providing data storage and retrieval capabilities that developers can leverage to build a wide range of software solutions.
Overall, databases are essential components of modern information systems, enabling efficient, secure, and reliable management of data across a variety of domains and applications.
This differentiation is made according to the interaction of users to the database. Database system is made to store information and provide an environment for retrieving information. There are four types of database users in DBMS
As its name shows, application programmers are the one who writes application programs that uses the database. These application programs are written in programming languages like COBOL or PL (Programming Language 1), Java and fourth generation language. These programs meet the user requirement and made according to user requirements. Retrieving information, creating new information and changing existing information is done by these application programs.
They interact with DBMS through DML (Data manipulation language) calls. And all these functions are performed by generating a request to the DBMS.
End users are those who access the database from the terminal end. They use the developed applications and they don’t have any knowledge about the design and working of database. These are the second class of users and their main motto is just to get their task done. There are basically two types of end users that are discussed below.
Casual User
These users have great knowledge of query language. Casual users access data by entering different queries from the terminal end. They do not write programs but they can interact with the system by writing queries.
Naive
Any user who does not have any knowledge about database.. There task is to just use the developed application and get the desired results by . For example: Clerical staff in any bank is a naïve user. They don’t have any dbms knowledge but they still use the database and perform their given task.
DBA can be a single person or it can be a group of person. Database Administrator is responsible for everything that is related to database. He makes the policies, strategies and provides technical supports. DBA has full control over data in database and has all privileges of database and also access/grant or remove previlages to other users in database. DBA also
System analyst is responsible for the design, structure and properties of database. All the requirements of the end users are handled by system analyst. Feasibility, economic and technical aspects of DBMS is the main concern tasks of system analyst
Databases offer numerous advantages for managing and organizing large amounts of data efficiently. Some key advantages of using databases include:
Data Centralization: Databases provide a centralized repository for storing data. This ensures that all relevant data is stored in one place, making it easier to access and manage. Centralization also promotes data consistency and reduces data redundancy, as multiple users or applications can access and update the same data in a controlled manner.
Data Integrity: Databases employ various mechanisms, such as data constraints and validation rules, to ensure data integrity. These mechanisms help enforce data accuracy, consistency, and validity. With a well-designed database schema and proper constraints, you can minimize data inconsistencies and errors.
Data Security: Databases offer robust security features to protect sensitive information. Access controls, encryption, and authentication mechanisms can be implemented to restrict unauthorized access and safeguard data from breaches or unauthorized modifications. Databases also provide features like backups and disaster recovery options to prevent data loss.
Efficient Data Retrieval: Databases utilize powerful query languages (e.g., SQL) and indexing techniques to efficiently retrieve data based on specific criteria. With proper indexing and optimization, databases can quickly locate and retrieve the required data, even from vast datasets. This enables faster and more efficient data processing, especially when dealing with complex queries or large volumes of information.
Concurrent Access and Scalability: Databases support concurrent access, allowing multiple users or applications to access and modify the data simultaneously. They handle concurrency control to ensure data consistency and prevent conflicts. Additionally, databases can scale horizontally or vertically to accommodate increasing data volumes and user loads, ensuring performance and responsiveness as the system grows.
Data Consistency and Atomicity: Databases provide transactional capabilities, ensuring that groups of operations either complete entirely or are rolled back to their initial state if an error occurs. This property, known as atomicity, helps maintain data consistency and integrity during complex data manipulations. It prevents partial updates, ensuring that the database remains in a valid state at all times.
Data Analysis and Reporting: Databases support advanced analytical operations, such as aggregations, joins, and filtering, which enable powerful data analysis and reporting capabilities. By leveraging these features, organizations can extract meaningful insights, generate reports, and make data-driven decisions to drive business growth.
Overall, databases offer significant advantages in terms of data organization, integrity, security, efficiency, and scalability. They form the backbone of many applications and systems, facilitating effective data management and supporting critical business operations.
Relational DataBase Management System (RDBMS) is a software that −
Before we proceed to explain the MySQL database system, let us revise a few definitions related to the database.
Entity: In the context of a Relational Database Management System (RDBMS), an entity refers to a distinct and identifiable object, concept, or thing that is represented and stored in a database. It can be a real-world object, such as a customer, product, or employee, or an abstract concept, such as an order, invoice, or transaction.\
Entities in an RDBMS are typically represented as tables. Each entity is defined by its attributes, which describe the characteristics or properties of the entity. For example, an "Employee" entity might have attributes such as "Employee ID," "Name," "Date of Birth," "Department," and "Salary."
Entities in an RDBMS are often related to each other through relationships. For instance, in a company database, an "Employee" entity may have a relationship with a "Department" entity, where multiple employees can belong to a single department. These relationships are established through keys, such as primary keys and foreign keys, which allow data in different tables to be linked together.
Entities play a crucial role in database design and data modeling
Table: A table is a collection of related data organized in rows (also called records) and columns (also called fields). Tables are used to store and organize data in a structured manner. Each table in a database typically represents a specific entity and consists of records and fields that define the attributes and characteristics of the entity.
Record: A record, also known as a row or tuple, represents a single instance or occurrence of an entity in a table. It contains a set of related data fields that describe various attributes or properties of the entity. For example, in a table representing "Employees," each record would represent a specific employee and contain fields such as name, employee ID, department, and salary.
Field: A field, also known as a column or attribute, represents a specific piece of information within a record. Each field in a table corresponds to a particular characteristic or property of the entity being represented. For instance, if we consider the "Employees" table, the fields could include name, employee ID, department, and salary. Fields define the structure and data types of the information that can be stored in them, such as text, numbers, dates, or binary data.
In the context of a Relational Database Management System (RDBMS), keys are used to uniquely identify records within a table and establish relationships between tables. There are several types of keys, including primary keys, composite keys, and foreign keys.
Primary Key: A primary key is a unique identifier for each record in a table. It uniquely identifies a specific record and ensures that no two records in the table have the same key value. The primary key is typically chosen from one or more attributes (columns) of the table and is used to enforce entity integrity. In most cases, a primary key is a single attribute, such as an "ID" column. However, it can also be composed of multiple attributes (composite key) to ensure uniqueness. Every table in a database should have a primary key.
Composite Key: A composite key is a primary key that consists of two or more attributes (columns) in a table. It is used when a single attribute cannot uniquely identify a record, but a combination of attributes can. By combining multiple attributes as a composite key, the combination of their values becomes unique and identifies a specific record. For example, in a table storing student enrollments, a composite key could be formed by combining the "Student ID" and "Course ID" columns.
Foreign Key: A foreign key is a column or set of columns in one table that refers to the primary key in another table. It establishes a relationship between two tables, enabling data integrity and enforcing referential integrity. The foreign key in one table is used to reference the primary key of another table, creating a link between the two. This relationship allows data to be shared and maintained across tables. For example, if there are two tables, "Orders" and "Customers," the "Customer ID" column in the "Orders" table could be a foreign key that references the "Customer ID" primary key in the "Customers" table.
Foreign keys help maintain consistency and integrity between related tables by ensuring that the referenced values exist in the referenced table's primary key. They enable the enforcement of referential integrity constraints and enable actions such as cascading updates and deletes, where changes in the referenced table can automatically propagate to related tables.
In summary, primary keys uniquely identify records within a table, composite keys are composed of multiple attributes to ensure uniqueness, and foreign keys establish relationships between tables by referencing the primary key of another table. These key concepts are fundamental in relational databases for data integrity and maintaining relationships between entities.
Referential integrity is a concept in relational databases that ensures the consistency and accuracy of data relationships between tables. It ensures that references between tables are valid and that data dependencies are maintained correctly. Referential integrity is enforced through the use of primary keys and foreign keys.
When a foreign key is defined in a table, it establishes a relationship with the primary key of another table. The referential integrity rule states that the values in the foreign key column must match the values in the primary key column of the referenced table, or they should be null.
Referential integrity provides the following benefits:
If a user attempts to perform an operation that violates referential integrity, such as inserting a foreign key value that does not exist in the referenced table, the database system will raise an error and prevent the operation from being executed. This ensures that data remains consistent and accurate.
In summary, referential integrity is a set of rules and constraints that maintain the consistency and accuracy of data relationships in a relational database. It ensures that foreign key values correspond to valid primary key values in referenced tables, preventing data inconsistencies and maintaining data integrity
In a database, relationships define how tables are connected to each other based on common data elements. In a database, a relationship refers to the association or connection between two or more tables based on common data elements. Relationships are established to represent how data in different tables are related to each other, enabling efficient data retrieval, data integrity, and data consistency. Relationships are typically defined using primary keys and foreign keys.There are several types of relationships commonly used in database design:
Data Models represent the structure and organization of data within a database.
There are several types of database models, including hierarchical, network, relational, object-oriented, and NoSQL. Here's an explanation of each type along with a diagram illustrating their structure.
Hierarchical Model: The hierarchical model represents data in a tree-like structure, where each record has a single parent and can have multiple children. The parent-child relationship forms a hierarchy. This model was widely used in early database systems. However, it has limited flexibility and can be cumbersome to navigate and maintain.
Network Model: The network model is an extension of the hierarchical model and allows records to have multiple parents, forming a network-like structure. It overcomes some of the limitations of the hierarchical model by providing more flexibility in defining relationships between records. However, it can still be complex to implement and maintain.
Relational Model: The relational model is the most widely used database model today. It organizes data into tables consisting of rows and columns, and establishes relationships between tables using primary keys and foreign keys. It provides a simple, tabular structure and supports powerful query capabilities through SQL (Structured Query Language).
Cloud databases
A cloud database is a collection of data, either structured or unstructured, that resides on a private, public, or hybrid cloud computing platform. There are two types of cloud database models: traditional and database as a service (DBaaS). With DBaaS, administrative tasks and maintenance are performed by a service provider
Object-Oriented Model: The object-oriented model represents data as objects, similar to object-oriented programming. It extends the relational model by allowing complex data structures and behaviors to be encapsulated within objects. It provides features like inheritance, polymorphism, and encapsulation. Object-oriented databases are particularly suitable for applications with complex data models and object-oriented programming paradigms.
Distributed databases
A distributed database consists of two or more files located in different sites. The database may be stored on multiple computers, located in the same physical location, or scattered over different networks.
NoSQL (Non-relational) Model: NoSQL databases depart from the traditional relational model and provide flexible schema designs to handle unstructured, semi-structured, or rapidly changing data. NoSQL databases can be classified into various types, such as document-oriented, key-value, columnar, and graph databases. These models are optimized for specific use cases, such as scalability, high-performance, or handling large amounts of data.
DBMS serves as a software application that facilitates the management and manipulation of databases. It provides a set of functions and services to efficiently store, organize, retrieve, and secure data. Some key functions of a DBMS include:
The main purpose of data dictionary management is to ensure consistency, accuracy, and understanding of the data within an organization. It serves as a valuable resource for data analysts, developers, database administrators, and other stakeholders involved in managing and using the data.
Here are some key aspects of data dictionary management:
Data Element Definition: A data dictionary includes a list of data elements used in the organization's data systems. Each data element is defined with attributes such as name, description, data type, length, format, and permissible values. It provides a standardized and consistent definition of data elements across different systems.
Data Structure and Relationships: The data dictionary describes the structure and relationships between various data elements. It specifies how the data elements are organized, the hierarchy or schema of the data, and the relationships or associations between different data elements.
Data Usage and Access: The data dictionary may also include information about data usage, such as which applications or systems use a particular data element and who has access to it. This helps in managing data security, data governance, and compliance requirements.
Data Transformation and Integration: Data dictionaries play a crucial role in data integration and transformation processes. They provide insights into the meaning and interpretation of data elements, facilitating data mapping, data migration, and data transformation activities.
Data Quality and Standards: Data dictionaries can include data quality rules, validation criteria, and standards for data entry, ensuring data consistency, accuracy, and integrity. It helps in enforcing data quality practices and enables data profiling and cleansing activities.
Documentation and Collaboration: A well-maintained data dictionary serves as a documentation tool, capturing the knowledge about data assets within an organization. It supports collaboration among different stakeholders by providing a common understanding of data definitions and structures.
Maintenance and Updates: Data dictionaries require regular maintenance and updates to keep pace with evolving data needs, changes in data structures, and business requirements. It is important to establish processes and responsibilities for managing the data dictionary, ensuring it remains up to date and reliable.
Effective data dictionary management can improve data understanding, promote data consistency, support data governance efforts, and facilitate efficient data management practices within an organization.
Data storage management refers to the activities and processes involved in efficiently and effectively managing an organization's data storage infrastructure. It includes planning, provisioning, organizing, optimizing, and maintaining storage resources to ensure the reliable and secure storage of data.
Here are some key aspects of data storage management:
Capacity Planning: Capacity planning involves assessing current and future data storage needs to determine the amount of storage required. It considers factors such as data growth rate, anticipated workloads, and storage utilization trends. Capacity planning helps organizations allocate storage resources appropriately and avoid storage shortages or excessive costs.
Storage Provisioning: Storage provisioning involves allocating storage resources to applications, systems, or users. It includes tasks such as creating storage volumes, assigning storage space, and configuring access controls. Proper provisioning ensures that storage resources are allocated efficiently and in accordance with the specific needs of the data and applications.
Data Organization and Classification: Data storage management involves organizing data in a structured manner to optimize data access, retrieval, and maintenance. This may include implementing folder structures, directories, or hierarchical storage systems. Additionally,
Overall, DBMS plays a crucial role in managing databases effectively, ensuring data integrity, security, and providing efficient data manipulation and retrieval capabilities
Data modeling is the process of creating a conceptual representation of data and its relationships to facilitate effective data management and analysis. It involves designing the structure, organization, and relationships of data elements in a database or information system. Data models serve as a blueprint for databases, helping to define how data is stored, accessed, and manipulated.
Importance of Data Modeling:
In summary, data modeling is essential for effective data management, analysis, and application development. It provides a structured approach to understand, organize, and utilize data, ensuring data integrity, consistency, and usability throughout its lifecycle
An Entity Relationship Diagram (ERD) is a graphical representation that depicts the relationships between entities in a database. ERD is a visual representation of the entities (objects or concepts), attributes, and relationships within a database. It uses various symbols and notations to represent these elements. It is a widely used modeling technique in the field of database design. ERDs use various symbols and notations to visually represent entities, attributes, and relationships, providing a clear and concise overview of the database structure.
Elements/ components of an ERD include:ERDs provide a visual representation of the database structure, helping designers, developers, and stakeholders understand the relationships and dependencies between entities. They serve as a communication tool during the database design process, enabling effective collaboration and documentation. ERDs are widely used in various stages of database development, from initial design and planning to implementation and maintenance.
It involves mapping the entities, attributes, and relationships from the ERD to tables, columns, and relationships in a relational database.
Here's a step-by-step process for transforming an ERD into a relational schema:
a. One-to-One Relationship: For a one-to-one relationship between two entities, you can choose to merge the entities into a single table. Identify one of the entities as the primary entity, and add a foreign key column in the primary entity's table to refer to the primary key of the other entity.
b. One-to-Many Relationship: For a one-to-many relationship, the primary key of the "one" side entity becomes a foreign key in the "many" side entity. Add a foreign key column in the "many" side entity's table to refer to the primary key of the "one" side entity.
c. Many-to-Many Relationship: For a many-to-many relationship, create a separate table, known as a junction table or associative table, to represent the relationship. The junction table will have foreign key columns referring to the primary keys of both entities involved in the relationship.
Normalization is the process of organizing data in a relational database to eliminate redundancy and dependency issues. It involves dividing database tables into smaller, more manageable components and establishing relationships between them. Here are the three most commonly used normal forms:
Normalization beyond 3NF, such as Boyce-Codd Normal Form (BCNF) or Fourth Normal Form (4NF), may be necessary in certain complex scenarios to eliminate further anomalies and dependencies.
It's important to note that normalization is not always about achieving the highest normal form possible. Sometimes, denormalization techniques are applied to improve performance or simplify data retrieval. The level of normalization depends on the specific requirements and trade-offs of the database design
Tthe language of the relational database, SQL stands for the structured query language. SQL is the standardized language used to access the database.
ANSI/SQL defines the SQL standard. The current version of SQL is SQL:2016.
Keep in Mind That...
select is the same as SELECT
SQL contains three parts:
MySQL is a popular open-source relational database management system used to store and manage data. It is commonly used for web applications and is supported by most web hosting providers. MySQL is a database management system that allows you to manage relational databases. best RDBMS being used for developing web-based software applications It is open source software backed by Oracle. Even though MySQL is open source software, you can buy a commercial license version from Oracle to get premium support services.
MySQL can run on various platforms UNIX, Linux, Windows, etc. You can install it on a server or even in a desktop. Besides, MySQL is reliable, scalable, and fast.
MySQL is pretty easy to master in comparison with other database software like Oracle Database, or Microsoft SQL Server.
MySQL is a widely used relational database management system (RDBMS).
MySQL is free and open-source.
MySQL is ideal for both small and large applications.
MySQL is a very popular open-source relational database management system (RDBMS).
MySQL features ,how is becoming so popular because of many good reasons
you will learn step by step how to install MySQL on the Windows platform using the MySQL Installer. After the tutorial, you will have a MySQL server and its tools up and running on your system for learning and practicing.
If you want to install MySQL on the Windows environment, using MySQL installer is the easiest way. MySQL installer provides you with an easy-to-use wizard that helps you to install MySQL with the following components:
To download MySQL installer, go to the following link http://dev.mysql.com/downloads/installer/. There are two installer files:
mysql-installer-web-community-<version>.exe .mysql-installer-community-<version>.exe file.
how to connect to MySQL Server using mysql command-line client and MySQL Workbench.
Once you have the MySQL Server installed, you can connect to it using any client program such as mysql command-line client and MySQL workbench.
mysql is a command-line client program that allows you to interact with MySQL in the interactive and non-interactive mode.
The mysql command-line client is typically located in the bin directory of the MySQL’s installation folder.
To invoke the mysql program, you just simply navigate to the bin directory of the MySQL’s installation folder and type: mysql
Code language: SQL (Structured Query Language) (sql)
If the mysql program is already in the PATH, you can simply invoke it using mysql command.
To connect to the MySQL Server, you use this command:
shell>mysql -u root -p
Code language: SQL (Structured Query Language) (sql)
-u root means that you connect to th