Professional Documents
Culture Documents
VIEWS
هنا بكتب اسماء االعمدة اللى.] CREATE OR REPLACE VIEW view_name DROP VIEW view_name 1- restriction to data access 2- MAKE COMPLEX QUERIES EASY 3-PROVIDE DATA 4-PRESENT DIFFRENT VIEWS OF
INDEPENDENCE THE DATA
للجدول على بعضهPRIVILEGE بتعملDCL عشان ال
عشان بجزء الجداول الى اجزاء صغير و ابص بيبص لجدول الموظفين غير المديرHR يعنى ال
Views can be used as security VIEW عليها من خالل ال وهكذا
mechanisms by letting users access
data through the view, without
granting the users permissions to
directly access the underlying base VIEWS انواع ال
tables of the view.
1.1.1. Unless indexed, a view does not exist as a stored set of data values in a database.
Link:
https://docs.microsoft.com/en-us/sql/relational-databases/views/views?view=sql-server-ver16
1.2.1. CREATE VIEW [ لو انا مكتبتش اسماء هنا هينزلهم زى ما هو اسمهم فى الجدول االصلىSELECT STATEMENT هنا بكتب اسماء االعمدة اللى عايز اعيد تسميتها اللى عملت لها كويرى فى ال.] AS من هنا هبدا اكتب ال صب كويرى اللى عايز ال فيو يعملهاSELECT F.Name, L.name >>>> هنا بكتب االعمدة المختارةFROM EMPLYE ,PROJEC, WORKS ON >>>> هنا بكتب الجداول اللى هاخد منها االعمدة اللى فوقWHERE SSN=ESSN AND C1.T1=C2.T2 >>>JOIN CONDITION
هنا بكتب الجداول اللى باخد منها االعمدة اللى فوق و هنا لو حطيت اكتر من جدول بحط الWITH CHECK OPTION >>> DML محقق لما اجى اعمل اىWHERE CONDITION بستخدمه انه بتحقق ان ال
1.3. HOW TO MODIFY THE VIRE
1.5.1. 1- restriction to data access للجدول على بعضهPRIVILEGE بتعملDCL عشان ال
1.5.1.1. Views can be used as security mechanisms by letting users access data through the view, without granting the users permissions to directly access the underlying base tables of the view.
1.5.1.1.1. انا ممكن استخدمه لتغير ميعن فى اعمدة معينة فى الداتا مش الزم ادى الشخص اللى هيغير دةFULL PRIVILEGE TO ACCESS THE TABLE
1.5.3.1. عشان بجزء الجداول الى اجزاء صغير و ابص عليها من خالل الVIEW
1.6.1. بالنسبة للCOMPLEX VIEWS ياثر انه لو جيت اعمل.. طيب دة ياثر علي ايه... دى فيو بتبقى االعمدة اللى فيها مش حقيقيةDML OPERATION زى مثال انى اعملINSERT OR UPDATE ساعتها مش هعرف
1.6.3.1. Indexed Views An indexed view is a view that has been materialized. This means the view definition has been computed and the resulting data stored just like a table. You index a view by creating a unique clustered index on it. Indexed views can dramatically improve the performance of some types of queries. Indexed views work best for queries that aggregate many rows. They are not well-suited for underlying data sets that are frequently updated.
1.6.3.2. Partitioned Views A partitioned view joins horizontally partitioned data from a set of member tables across one or more servers. This makes the data appear as if from one table. A view that joins member tables on the same instance of SQL Server is a local partitioned view.
1.6.3.3. System Views System views expose catalog metadata. You can use system views to return information about the instance of SQL Server or the objects defined in the instance. For example, you can query the sys.databases catalog view to return information about the user-defined databases available in the instance. For more information, see System Views (Transact-SQL)