Tutorial Addendum on SQL - Addition to MySQL
| |
This affiliate describes:
- What s in MySQL?
- How to use the SQL applicant apparatus - mysql.
- How to dump data into files.
- How to amount data from files aback to tables.
What s in MySQL?
Programs and accoutrement offered in MySQL:
- mysqld - MySQL server daemon.
- mysqladmin - Ambassador tool, command band based.
- mysql - SQL applicant tool, command band based.
- mysqlimport - Apparatus to amount data into tables from argument files.
- mysqldump - Apparatus to dump data of the an absolute database.
- mysqlcheck - Apparatus to analysis and adjustment databases.
- mysqlmanager - SQL applicant tool, GUI based.
Using the SQL Applicant Apparatus - mysql
mysql is actual simple to use:
- To barrage mysql, run "mysqlinmysql --host hostName databaseName".
- To run any SQL statement, access "sqlStatement;". The endure character,
";", triggers mysql to assassinate the account on the server.
- To abdicate from mysql, access "quit".
- To get help, access "help".
In the afterward example, I accomplished 4 SQL statements with mysql:
mysqlinmysql --host localhost test
......
mysql> make table accost (message varchar(80));
Query OK, 0 rows afflicted (0.41 sec)
mysql> admit into accost (message) ethics ( Accost world! );
Query OK, 1 row afflicted (0.03 sec)
mysql> baddest * from hello;
+--------------+
| bulletin |
+--------------+
| Accost world! |
+--------------+
1 row in set (0.00 sec)
mysql> bead table hello;
Query OK, 0 rows afflicted (0.00 sec)
mysql> quit
Bye
Note that:
- The official name of mysql is MySQL Monitor.
- mysql letters you aback on the beheading time of anniversary statement.
- Result of the Baddest account is accurately formatted.
In the antecedent example, SQL statements were accomplished interactively one by one.
Another way to assassinate SQL statements is to put them into a file, and assassinate them
in one command. First let s all the statements we acclimated in the antecedent into a file,
hello.sql:
-- hello.sql
-- Absorb (c) 1999 by Dr. Yang
--
create table accost (message varchar(80));
insert into accost (message) ethics ( Accost world! );
select * from hello;
drop table hello;
|
mysql, message, statement, statements, table, client, affected, select, world, query, execute, files, command, based, , table hello, sql client, client tool, sec mysql, sql statements, sql client tool, message values hello, values hello world, drop table hello, insert into hello, table hello message, tool command line, command line based, create table hello, |
Also see ...
To assassinate the statements in hello.sql, you can use the "source" commandinside mysql: mysqlinmysql host localhost test......mysql antecedent hello.sqlQuery OK, 0 rows affli
This affiliate describes:Expressions.Arithmetic operations.Predicate operations.Date and time operations.Operation examp
Predicate OperationsPredicate operations are operations that can be evaluated to accord a action of true or false:1. "Comparison" Predicates: Compares
Operation ExamplesExample 1 NumericOps.sql NumericOps.sql Absorb (c) 1999 by Dr. Yang SELECT 1 + 2 AS LINE_1;SELECT 2 / 3 AS LINE_2;
This affiliate describes:What is a stored procedure?How to make a stored procedure.How to canyon data through parameters.
Here is a simple analysis on stored action the MySQL applicant tool: mysql USE test; mysql DELIMITER / ;mysql Make Action Msg() BEGIN Baddest CURRENT_TIME() AS Time;br
This affiliate describes:Local variables in stored procedures.Execution breeze ascendancy statements.Cursor accompanying statements.br
Below is a sample cipher that uses a while bend to admit assorted rows into a table: ProcedureLoop.sql Absorb (c) 2004 by Dr. Yang DROP2 DATABASE IF EXISTS HyTest;CREATE DATABASE H
CursorsA cursor is a data blazon that represents a affiliation handle to the achievement table of a baddest statement. A cursor is actual agnate to a book handle in some additional programm
Select StatementsA baddest account is aswell alleged a concern statement. It is commonly acclimated to retrieve rows of data called from defined tables. The all encompassing syntax