Update for 28-02-22 16:15
This commit is contained in:
parent
5650ddb8ac
commit
bfcafab2be
@ -6,8 +6,27 @@ network, with caching and other optimizations.
|
||||
== Database Design Principle ==
|
||||
|
||||
|
||||
== Views ==
|
||||
|
||||
A database view is a subset of a database and is based on a query that runs on
|
||||
one or more database tables. There are essentially named queries.
|
||||
|
||||
=== dynamic views ===
|
||||
|
||||
dynamic views can contain data from one or two tables and automatically include
|
||||
all of the columns from the specified table or tables. They are automatically
|
||||
updated along with data in the source tables
|
||||
|
||||
=== static views ===
|
||||
|
||||
static views contain data from multiple tables and and the columns from said
|
||||
tables are included via SELECT and WHERE commands.
|
||||
|
||||
|
||||
|
||||
|
||||
== SQL ==
|
||||
|
||||
See [[../lang/sql]]
|
||||
See [[sql]]
|
||||
|
||||
[[index]]
|
||||
|
@ -3,9 +3,48 @@
|
||||
Stuctered Query Language is a language that describes a method of fetching and
|
||||
describing the relationship between different types of data
|
||||
|
||||
== Views ==
|
||||
|
||||
A view can be created with the following command
|
||||
|
||||
{{{
|
||||
CREATE VIEW [view_name] AS
|
||||
SELECT column1, column2, ...
|
||||
FROM table
|
||||
WHERE condition;
|
||||
}}}
|
||||
|
||||
For example, this view returns all products witha price higher than the average
|
||||
price of the table
|
||||
|
||||
{{{
|
||||
CREATE VIEW [Products above average price] AS
|
||||
SELECT Name, Price
|
||||
FROM Products
|
||||
WHERE Price > (SELECT AVG(Price) FROM Products)
|
||||
|
||||
SELECT * FROM [Prodcuts above average price]
|
||||
}}}
|
||||
|
||||
== Acess control commands ==
|
||||
|
||||
Two commands for managing access rights
|
||||
|
||||
* grant
|
||||
* used to grant one or more access rights or can be used to assign a user to
|
||||
a role
|
||||
* revoke
|
||||
* revokes the acess rights
|
||||
|
||||
Typical access rights include
|
||||
|
||||
* select
|
||||
* insert update
|
||||
* delete
|
||||
* references
|
||||
|
||||
== Also see ==
|
||||
|
||||
[[../tech/databases]]
|
||||
[[databases]]
|
||||
|
||||
[[../index]]
|
||||
[[index]]
|
||||
|
@ -7,3 +7,9 @@ An attack typically works by prematurely terminating a text string and
|
||||
appending a new command. Because the inserted command may have additional
|
||||
strings appended to it before it is executed, SQLI attack string generally end
|
||||
with a comment or `--`.
|
||||
|
||||
|
||||
|
||||
== Also see ==
|
||||
|
||||
Also see [[sql]]
|
||||
|
Loading…
Reference in New Issue
Block a user