Skip to content

First & Second Stage: Building Database & Access the Database

Asep Septiadi edited this page Oct 24, 2021 · 2 revisions

Hi, Coders!

In this section, we will learn a basic SQL Query, namely Create Database, where we will create a database into our DBMS, the following is an explanation

Query #1 : Create Database Syntax

Query #1

In this section, the following Query snippets can be applied

CREATE DATABASE db_campus;

Here's an example of its application

Execute Query #1

Well Done. What next

Query #2 : Checking Database if Exist

If you have created it, check whether the database exists or not on the MySQL DBMS server, With a query like the following

Check Database

In this section, the following Query snippets can be applied

SHOW DATABASES;

Here's the result of the execution

Check Database

Query #3 : Access & Using the Database

If we have found the database is already available in the MySQL DBMS, we can simply use the USE query to access the database and manage the data in it

Access Database

In this section, the following Query snippets can be applied

USE db_campus;

Here's the result of the execution

Using Database

Notes:
If you have successfully accessed the database, make sure you don't access another database, because it will potentially make mistakes when managing the data in it, either when creating tables, but the table is not in the database in question, it happens very often, so make sure you have accessed the database. What is meant is