In this section, we are going to explain the things that you should know about creating and using a database. Learn about creating and using a database is very important for programmers
This improves your knowledge in the following areas.
CREATE DATABASE database_name;
To make use of this database, you have to use the use command.
USE database_name;
There is an alternate way to select the database. Just specify the name and connection parameters that you need to provide.
mysql -h host -u user -p database_name
Enter password: ********
CREATE TABLE table_name (
col1 datatype,
col2 datatype,
col3 datatype,
....
);
After creating the table there are two ways to load the data into the table. They are load and insert.
Loading the data using LOAD command,
LOAD DATA LOCAL INFILE '/path_to_the_file_folder/file_name.txt' INTO TABLE table_name;
SELECT col1,col2....coln
FROM table_name1, table_name2....
WHERE conditions
[OFFSET O][LIMIT L]