Download presentation
Presentation is loading. Please wait.
1
පාඨමාලා මාතෘකා Microsoft SQL Server Databases සැකසීම
01 | Tables සහ Views 06 | Queries Optimize සහ Troubleshoot කිරීම 02 | Indexes තේරුම් ගැනීම 03 |Stored Procedures සහ Functions භාවිතය 04 | Transactions කළමනාකරණය 05 | In-Memory Objects
2
SQL Server Books Online
නිෂ්පාදන ලේඛන ගත කිරීම හා මග පෙන්වීම. TechNet හා MSDN හි ප්රකාශිතයි. ස්ථානීය අනුවාද ද ලබා ගත හැක.
3
MVA සමඟ එක් වන්න! Microsoft Virtual Academy
IT Pros සහ Developers ලා වෙනුවෙන් සැකසුණු පාඩම් මාලා රැසක් මිලියනයකට අධික ලියාපදිංචි පරිශීලකයන් යාවත්කාලීන දැනුම් සාගරය
4
Prabhath Mannapperuma @dprabhathm
01 | Tables සහ Views Prabhath Mannapperuma @dprabhathm
5
මොඩියුල විශ්ලේෂණය Tables, Schemas සහ Views
Temporary Tables සහ Table Variables Common Table Expressions Table Partitioning
6
Tables නිර්මාණය spaces, keywords සහ symbols අඩංගු නම් යොදා ගන්න එපා.
සෑම තීරුවකම දත්ත වර්ග සැලසුම් කරන්න. Null අගයන්ට ඉඩ දෙනවා ද යන්න සැලසුම් කරන්න. primary key සහ foreign key constraints සැලසුම් කරන්න. indexes සැලසුම් කරන්න.
7
Tables නිර්මාණය
8
Schemas සමඟ වැඩ කිරීම Naming boundary Security boundary
Logically group database objects Security boundary [Server.][Database.]Schema.Object GRANT EXECUTE ON SCHEMA::Sales
9
Default Schema සහ Name Resolution
SELECT * FROM Product User 1 (Default Schema: Sales) User 3 (No Default Schema) Sales.Product dbo.Product User 2 (Default Schema: Ops) Sales Ops dbo
10
Schemas සමඟ වැඩ කිරීම.
11
Views යනු? CREATE VIEW HumanResources.EmployeeList (EmployeeID, FamilyName, GivenName) AS SELECT EmployeeID, LastName, FirstName FROM HumanResources.Employee;
12
Views හඳුන්වා දීම.
13
Temporary Tables CREATE TABLE #tmpProducts (ProductID INTEGER,
ProductName varchar(50));
14
Table Variables DECLARE @tmpProducts table (ProductID INTEGER,
ProductName varchar(50));
15
Table Variables සහ Temporary Tables
16
Common Table Expressions
WITH CTE_year AS ( SELECT YEAR(orderdate) AS orderyear, custid FROM Sales.Orders ) SELECT orderyear, COUNT(DISTINCT custid) AS cust_count FROM CTE_year GROUP BY orderyear;
17
Common Table Expressions
18
Partitioned Tables Sales.Order Filegroup 2000 Filegroup 2001
Date Order Total 123 999.99 125 287.99 Date Order Total 258 199.99 259 257.99 Date Order Total 368 199.99 369 257.99 Date Order Total 547 129.99 Filegroup 2000 Filegroup 2001 Filegroup 2002 Filegroup 2003
19
Creating a Partitioned Table
CREATE PARTITION FUNCTION PFYears (datetime) AS RANGE RIGHT FOR VALUES ( , , ); --creates 4 partitions: -- <-2000, , , 2002-> CREATE PARTITION SCHEME PSYears AS PARTITION PFYears TO (FG0000, FG2000, FG2001, FG2002, FG2003); -- FG2003 is marked as ‘next used’ CREATE TABLE Sales.Order (OrderDate datetime, OrderNo int, Customer varchar(50), OrderAmount money) ON PSYears(OrderYear);
20
Partitioned Tables කළමනාකරණය
Split Partitions Merge Partitions Switch Partitions -- Create a new partition for 2003 orders -- (created on next used filegroup) ALTER PARTITION FUNCTION PFYears() SPLIT RANGE ( ); -- Merge 2000 and pre-2000 orders ALTER PARTITION FUNCTION PFYears() MERGE RANGE ( ); -- Switch partition containing old orders -- to a staging table for archiving ALTER TABLE Sales.Order SWITCH PARTITION $PARTITION.PFYears( ) TO archive_staging_table;
21
Table Partitioning
22
Tables සහ Views සම්පිණ්ඩනය Tables Schemas Views Temporary Tables
Table Variables Common Table Expressions Partitioned Tables
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.