harian untung99play.xyz

untung99play.xyz: A Basic MySQL Tutorial


Untung99 menawarkan beragam permainan yang menarik, termasuk slot online, poker, roulette, blackjack, dan taruhan olahraga langsung. Dengan koleksi permainan yang lengkap dan terus diperbarui, pemain memiliki banyak pilihan untuk menjaga kegembiraan mereka. Selain itu, Untung99 juga menyediakan bonus dan promosi menarik yang meningkatkan peluang kemenangan dan memberikan nilai tambah kepada pemain.

Berikut adalah artikel atau berita tentang Harian untung99play.xyz dengan judul untung99play.xyz: A Basic MySQL Tutorial yang telah tayang di untung99play.xyz terimakasih telah menyimak. Bila ada masukan atau komplain mengenai artikel berikut silahkan hubungi email kami di koresponden@untung99play.xyz, Terimakasih.

MySQL is the most popular Open Source Relational SQL database management system that helps users store, organize, and retrieve data. It is a very powerful program with a lot of flexibility — this tutorial will provide the simplest introduction to MySQL

How to Install MySQL on Ubuntu and CentOS

If you don’t have MySQL installed on your machine, you can quickly download it.

Windows:
https://dev.mysql.com/downloads/installer/

How to Access the MySQL shell

Once you have MySQL installed on your machine, you can access the MySQL shell by typing the following command into command prompt:

mysql -u root -p

After entering the root MySQL password into the prompt (not to be confused with the root machine password), you will be able to start building your MySQL database.

Two points to keep in mind:

1. You have to end the MySQL commands with a “semicolon;”.
2. MySQL commands line is not case sensitive.

How to Create and Delete a MySQL Database

MySQL organizes its information into databases; each one can hold tables with specific data.

You can quickly check what databases are available by typing:

SHOW DATABASES;

Your screen should look something like this:

mysql> SHOW DATABASES;
+ — — — — — — — — — — +
| Database |
+ — — — — — — — — — — +
| information_schema |
| mysql |
| performance_schema |
| test |
+ — — — — — — — — — — +
4 rows in set (0.01 sec)








Creating a database is very easy:

CREATE DATABASE database name;

In this case, for example, we will call our database “GUVI.”

mysql> SHOW DATABASES;
+ — — — — — — — — — — +
| Database |
+ — — — — — — — — — — +
| information_schema |
| GUVI |
| mysql |
| performance_schema |
| test |
+ — — — — — — — — — — +
5 rows in set (0.00 sec)









In MySQL, the phrase most often used to delete objects is Drop. You would delete a MySQL database with this command:

DROP DATABASE database name;

How to Access a MySQL Database

Once we have a new database, we can begin to fill it with information.

The first step is to create a new table within the larger database.

Let’s open up the database we want to use:

USE GUVI;

In the same way that you could check the available databases, you can also see an overview of the tables that the database contains.

SHOW tables;

Since this is a new database, MySQL has nothing to show, and you will get a message that says, “Empty set”
How to Create a MySQL Table

Let’s imagine that we are planning a get together of friends. We can use MySQL to track the details of the event.

Let’s create a new MySQL table:

CREATE TABLE Shared_Library_Reader (id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(20),
Book_Name VARCHAR(30),
confirmed CHAR(1),
signup_date DATE);



This command accomplishes a number of things:

It has created a table called Shared_Library_Reader within the directory, GUVI.
We have set up 5 columns in the table — id, name, Book_Name, confirmed, and signup date.
The “id” column has a command (INT NOT NULL PRIMARY KEY AUTO_INCREMENT) that auMSDatically numbers each row.
The “name” column has been limited by the VARCHAR command to be under 20 characters long.
The “Book_Name” column designates the Book_Name each person will bring. The VARCHAR limits text to be under 30 characters.
The “confirmed” column records whether the person has RSVP’d with one letter, Y or N.
The “date” column will show when they signed up for the event. MySQL requires that dates be written as yyyy-mm-dd





Let’s take a look at how the table appears within the database using the “SHOW TABLES;” command:

mysql> SHOW TABLES;
+ — — — — — — — — — — — — — — — — +
| Tables_in_GUVI |
+ — — — — — — — — — — — — — — — — +
| Shared_Library_Reader |
+ — — — — — — — — — — — — — — — — +
1 row in set (0.01 sec)





We can remind ourselves about the table’s organization with this command:

DESCRIBE Shared_Library_Reader;

Keep in mind throughout that, although the MySQL command line does not pay attention to cases, the table and database names are case sensitive: Shared_Library_Reader is not the same as Shared_Library_Reader or Shared_Library_Reader.

mysql>DESCRIBE Shared_Library_Reader;
+ — — — — — — -+ — — — — — — -+ — — — + — — -+ — — — — -+ — — — — — — — — +
| Field | Type | Null | Key | Default | Extra |
+ — — — — — — -+ — — — — — — -+ — — — + — — -+ — — — — -+ — — — — — — — — +
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(20) | YES | | NULL | |
| Book_Name | varchar(30) | YES | | NULL | |
| confirmed | char(1) | YES | | NULL | |
| signup_date | date | YES | | NULL | |
+ — — — — — — -+ — — — — — — -+ — — — + — — -+ — — — — -+ — — — — — — — — +
5 rows in set (0.01 sec)









How to Add Information to a MySQL Table

We have a working table for our party. Now it’s time to start filling in the details.

Use this format to insert information into each row:

INSERT INTO `Shared_Library_Reader` (`id`,`name`,`Book_Name`,`confirmed`,`signup_date`) VALUES (NULL, “John”, “Casonova”,”Y”, ‘2012–04–11’);

Once you input that in, you will see the words:

Query OK, 1 row affected (0.00 sec)

Let’s add a couple more people to our group:

INSERT INTO `Shared_Library_Reader` (`id`,`name`,`Book_Name`,`confirmed`,`signup_date`) VALUES (NULL, “Virat”, “Inevitable”,”N”, ‘2012–04–14’);
INSERT INTO `Shared_Library_Reader` (`id`,`name`,`Book_Name`,`confirmed`,`signup_date`) VALUES (NULL, “MSD”, “MOTM”,”Y”, ‘2012–04–18’);
INSERT INTO `Shared_Library_Reader` (`id`,`name`,`Book_Name`,`confirmed`,`signup_date`) VALUES (NULL, “Tull”, “Solid”,”Y”, ‘2012–04–10’);

We can take a look at our table:

mysql> SELECT * FROM Shared_Library_Reader;
+ — — + — — — -+ — — — — — — — — + — — — — — -+ — — — — — — -+
| id | name | Book_Name | confirmed | signup_date |
+ — — + — — — -+ — — — — — — — -+ — — — — — -+ — — — — — — -+
| 1 | John | Casonova | Y | 2012–04–11 |
| 2 | Virat | Inevitable | N | 2012–04–14 |
| 3 | MSD | MOTM | Y | 2012–04–18 |
| 4 | Tull | Solid | Y | 2012–04–10 |
+ — — + — — — -+ — — — — — — — -+ — — — — — -+ — — — — — — -+
4 rows in set (0.00 sec)








How to Update Information in the Table

Now that we have started our Shared_Library_Reader list, we can address any possible changes. For example: Virat has confirmed that she is attending, so we are going to update that in the table.

UPDATE `Shared_Library_Reader`
SET
`confirmed` = ‘Y’
WHERE `Shared_Library_Reader`.`name` =’Virat’;


You can also use this command to add information into specific cells, even if they are empty.
How to Add and Delete a Column

We are creating a handy chart, but it is missing some important information: our attendees’ emails.

We can easily add this:

ALTER TABLE Shared_Library_Reader ADD email VARCHAR(40);

This command puts the new column called “email” at the end of the table by default, and the VARCHAR command limits it to 40 characters.

However, if you need to place that column in a specific spot in the table, we can add one more phrase to the command.

ALTER TABLE Shared_Library_Reader ADD email VARCHAR(40) AFTER name;

Now the new “email” column goes after the column “name”.

Just as you can add a column, you can delete one as well:

ALTER TABLE Shared_Library_Reader DROP email;

I guess we will never know how to reach the picnickers.
How to Delete a Row

If needed, you can also delete rows from the table with the following command:

DELETE from [table name] where [column name]=[field text];

For example, if Virat suddenly realized that she will not be able to participate in the Shared_Library_Reader after all, we could quickly eliminate her details.

mysql> DELETE from Shared_Library_Reader where name=’Virat’;
Query OK, 1 row affected (0.00 sec)

mysql> SELECT * FROM Shared_Library_Reader;
+ — — + — — — + — — — — — -+ — — — — — -+ — — — — — — -+
| id | name | Book_Name | confirmed | signup_date |
+ — — + — — — + — — — — — -+ — — — — — -+ — — — — — — -+
| 1 | John | Casonova | Y | 2012–04–11 |
| 3 | MSD | MOTM | Y | 2012–04–18 |
| 4 | Tull | Solid | Y | 2012–04–10 |
+ — — + — — — + — — — — — -+ — — — — — -+ — — — — — — -+
3 rows in set (0.00 sec)







This is a basic tutorial and you can start learning other concepts from here…..