Database Reference
In-Depth Information
What these two lines are telling us is that one row matched our WHERE section and
that one row was changed.
Full documentation of the UPDATE command is found at https://mariadb.com/kb/
en/update/ .
Deleting data
When data needs to be removed from a database table, we use the DELETE command.
The basic syntax is as follows:
DELETE FROM <table_name> [WHERE <where_conditions> ];
As with UPDATE statements, the WHERE part of a DELETE statement is optional, but if
we leave it off, the command will delete every row in the table, which is even more
catastrophic than leaving off the WHERE part in an UPDATE statement, if such a thing is
possible, so make it a habit to always include it.
As an example, let's delete the Spencer Kimball employee:
DELETE FROM employees
WHERE givenname="Spencer" AND surname="Kimball";
Full documentation of the DELETE command is found at https://mariadb.com/kb/
en/delete/ .
Reading data
The command for reading data from our database is called SELECT . Of all SQL
commands, this is the one we will probably use most often. As such the syntax is
rather complex, or can be, if we choose to use all the various options. The basic
syntax is as follows:
SELECT <what> FROM <table_name>
[WHERE <where-conditions> ]
[ORDER BY <column_name> ];
 
Search WWH ::




Custom Search