From bfcafab2bec4a2eeacd4b0b31605e8de780e02ec Mon Sep 17 00:00:00 2001 From: Tyler Perkins Date: Mon, 28 Feb 2022 16:15:01 -0500 Subject: [PATCH] Update for 28-02-22 16:15 --- tech/databases.wiki | 21 ++++++++++++++++++++- tech/sql.wiki | 43 +++++++++++++++++++++++++++++++++++++++++-- tech/sqli.wiki | 6 ++++++ 3 files changed, 67 insertions(+), 3 deletions(-) diff --git a/tech/databases.wiki b/tech/databases.wiki index 1a7a036..1ce1f70 100644 --- a/tech/databases.wiki +++ b/tech/databases.wiki @@ -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]] diff --git a/tech/sql.wiki b/tech/sql.wiki index 1a1210c..a873a2f 100644 --- a/tech/sql.wiki +++ b/tech/sql.wiki @@ -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]] diff --git a/tech/sqli.wiki b/tech/sqli.wiki index 2d73cd2..1ac6010 100644 --- a/tech/sqli.wiki +++ b/tech/sqli.wiki @@ -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]]