{"id":164717,"date":"2013-01-04T15:11:03","date_gmt":"2013-01-04T11:11:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=164717"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=164717","title":{"rendered":"<span class=\"post_title\">\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 SQL Server \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432<\/span>"},"content":{"rendered":"<div class=\"content html_format\">\n<h4>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, <a href=\"http:\/\/ru.wikipedia.org\/wiki\/\u0418\u043d\u0434\u0435\u043a\u0441_(\u0431\u0430\u0437\u044b_\u0434\u0430\u043d\u043d\u044b\u0445)\">\u0438\u043d\u0434\u0435\u043a\u0441\u044b<\/a> \u043f\u043e\u0432\u044b\u0448\u0430\u044e\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0438\u043b\u0438 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u043e\u043c\u0443 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044e \u0432 \u043a\u043d\u0433\u0438\u0435. \u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u0442\u0435\u0439 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u0438 \u043f\u0430\u0440\u0443 \u0433\u043b\u0430\u0432 \u0438\u0437 \u043a\u043d\u0438\u0436\u0435\u043a, \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 SQL Server. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435. <a name=\"habracut\"><\/a><br \/>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0434\u0432\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u043a\u043b\u044e\u0447\u043e\u043c. \u0412 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0431\u0443\u0434\u0435\u0442 10 000 \u0441\u0442\u0440\u043e\u043a, \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u2014 1 000 000. \u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0438 2 \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u0441 \u0442\u0435\u043a\u0441\u0442\u043e\u043c, \u0432\u0442\u043e\u0440\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447, 2 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u044f, 2 \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u044f, \u0434\u0430\u0442\u0430, \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u044b\u0439 \u0441\u0442\u043e\u043b\u0431\u0435\u0446 \u0438 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447.<\/p>\n<h5>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445<\/h5>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0411\u0414<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">CREATE TABLE &quot;maintable&quot;( &quot;ID&quot; INT NOT NULL IDENTITY (1, 1) PRIMARY KEY, &quot;name&quot; NVARCHAR (50) NULL, &quot;description&quot; NVARCHAR (100) NULL )  CREATE TABLE &quot;secondtable&quot; ( &quot;ID&quot; INT NOT NULL IDENTITY (1, 1) PRIMARY KEY, &quot;sname&quot; NVARCHAR (50) NULL, &quot;sdescr&quot; NVARCHAR (100) NULL, &quot;somefirstnumber&quot; INT DEFAULT 0, &quot;somesecondnumber&quot; INT DEFAULT 1, &quot;somedatetime&quot; DATETIME NOT NULL, &quot;howmanyhours&quot; INT NULL DEFAULT 0, &quot;newdate&quot; AS DATEADD(HOUR, &quot;howmanyhours&quot;, &quot;somedatetime&quot;), &quot;mainID&quot; INT NOT NULL CONSTRAINT FK_SecondToMain FOREIGN KEY (&quot;mainID&quot;) REFERENCES &quot;maintable&quot; (&quot;ID&quot;) );  --\u0425\u0440\u0430\u043d\u0438\u043c\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b CREATE PROCEDURE &quot;insertintomain&quot; @Name NVARCHAR (50), @Descr NVARCHAR (100) AS \tINSERT INTO &quot;SimpleIndex&quot;.&quot;dbo&quot;.&quot;maintable&quot; (&quot;name&quot;, &quot;description&quot;) \tVALUES (@Name, @Descr); GO  CREATE PROCEDURE &quot;insertintosecond&quot; @Sname NVARCHAR(50), @Sdescr NVARCHAR(100), @Firstnumber INT, @Secondnumber INT, @SomeDT DATETIME, @Hours INT, @MainID INT AS \tINSERT INTO &quot;SimpleIndex&quot;.&quot;dbo&quot;.&quot;secondtable&quot; ( \t&quot;sname&quot;, &quot;sdescr&quot;, &quot;somefirstnumber&quot;,  \t&quot;somesecondnumber&quot;, &quot;somedatetime&quot;,  \t&quot;howmanyhours&quot;, &quot;mainID&quot;) \tVALUES ( \t@Sname, @Sdescr,@Firstnumber, @Secondnumber, \t@SomeDT, @Hours, @MainID) GO <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h5>\u0412\u0441\u0442\u0430\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/h5>\n<p>  \u041f\u043e\u043d\u044f\u0442\u043d\u043e\u0435 \u0434\u0435\u043b\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0442\u0430\u043a \u043d\u0435 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043c\u0438\u043b\u043b\u0438\u043e\u043d \u0441\u0442\u0440\u043e\u043a, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f C#.   <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Data; using System.Data.SqlClient;  namespace SimpleAddingRandomRecordsToDatabase {     class Program     {         static string alphabet()         {             \/\/\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u0432 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0447\u0430\u0441\u0442\u043e\u0442\u0443 \u0438\u0445 \u043f\u043e\u044f\u0432\u043b\u044f\u043d\u0438\u044f             string alphabet = &quot;abcdefgh ijklmnopqrst uvwxyz\u0430\u0431\u0432\u0433\u0434 \u0435\u0451\u0436\u0437\u0438\u0439\u043a\u043b \u043c\u043d\u043e\u043f\u0440\u043e\u0441\u0442\u0443 \u0444\u0445\u0446\u0447\u0448\u0449\u044b\u044d\u044e\u044f &quot;;              \/\/\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u0430\u043b\u0444\u0430\u0432\u0438\u0442 \u0432 \u044e\u043d\u0438\u043a\u043e\u0434             Encoding enc = Encoding.UTF8;             var bytes = enc.GetBytes(alphabet);             alphabet = enc.GetString(bytes);             return alphabet;         }          static int alphlen = alphabet().Length;          static string getRandomString(int lenth, int rndparam, bool allowspacebars)         {             string str = &quot;&quot;;             Random rand = new Random(rndparam);             for (int i = 0; i &lt; lenth; i++)             {                 int num = rand.Next(alphlen);                 str = str + alphabet()[num];             }             if (!allowspacebars)             {                 str = str.Replace(&quot; &quot;, &quot;&quot;);             }             return str;         }          static void Main(string[] args)         {                            string result;             Console.WriteLine(&quot;\u041d\u0430\u0436\u043c\u0438\u0442\u0435 1 \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438&quot;);             result = Console.ReadLine();             if (result.Equals(&quot;1&quot;))             {                 \/\/\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a \u0411\u0414                 SqlConnection cn = new SqlConnection();                 SqlConnectionStringBuilder cs = new SqlConnectionStringBuilder();                 cs.IntegratedSecurity = true;                 cs.DataSource = @&quot;KONSTANTIN\\KONSTANTINSQL&quot;;                 cs.InitialCatalog = &quot;SimpleIndex&quot;;                 cn.ConnectionString = cs.ToString();                 cn.Open();                  \/\/\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0435 10 000 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0434\u043b\u044f \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b                 int i2 = 0;                 for (int i = 0; i &lt; 10000; i++)                 {                     SqlCommand cm = cn.CreateCommand();                     cm.CommandType = CommandType.StoredProcedure;                     cm.CommandText = &quot;insertintomain&quot;;                     i2++;                     cm.Parameters.Add(new SqlParameter(&quot;Name&quot;, getRandomString(50, i2, false)));                     i2++;                     cm.Parameters.Add(new SqlParameter(&quot;Descr&quot;, getRandomString(100, i2, true)));                     cm.ExecuteNonQuery();                 }                     \/\/\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c 1 000 000 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0441\u043e\u0435\u0434\u043d\u0438\u0451\u043d\u043d\u044b\u0445 \u0441 \u043f\u0435\u0440\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439                 i2 = 0;                 for (int i = 0; i &lt; 1000000; i++)                 {                     Random rand = new Random();                     DateTime dt = DateTime.Now;                     dt = dt.AddHours((-1) * rand.Next(2000));                     SqlCommand cm = cn.CreateCommand();                     cm.CommandType = CommandType.StoredProcedure;                     cm.CommandText = &quot;insertintosecond&quot;;                     i2++;                     cm.Parameters.Add(new SqlParameter(&quot;Sname&quot;, getRandomString(50, i2, false)));                     i2++;                     cm.Parameters.Add(new SqlParameter(&quot;Sdescr&quot;, getRandomString(100, i2, true)));                     i2++;                     Random rand2 = new Random(i2);                     cm.Parameters.Add(new SqlParameter(&quot;Firstnumber&quot;, rand2.Next(10000)));                     i2++;                     rand2 = new Random(i2);                     cm.Parameters.Add(new SqlParameter(&quot;Secondnumber&quot;, rand2.Next(100)));                     cm.Parameters.Add(new SqlParameter(&quot;SomeDT&quot;, dt));                     i2++;                     rand = new Random(i2);                     cm.Parameters.Add(new SqlParameter(&quot;Hours&quot;, rand.Next(30)));                     i2++;                     rand = new Random(i2);                     cm.Parameters.Add(new SqlParameter(&quot;MainID&quot;, rand.Next(9999)+1));                     cm.ExecuteNonQuery();                 }                 cn.Close();                 Console.WriteLine(&quot;\u0414\u0430\u043d\u043d\u044b\u0435 \u0432\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b.&quot;);             }         }     } }  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0436\u043c\u0451\u043c \u00ab1\u00bb \u0438 \u0436\u0434\u0451\u043c. \u0423 \u043c\u0435\u043d\u044f \u0443\u0448\u043b\u043e \u043c\u0438\u043d\u0443\u0442 15-20 \u043d\u0430 \u0432\u0441\u0442\u0430\u0432\u043a\u0443.<\/p>\n<h4>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432<\/h4>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0432 \u043f\u0440\u043e\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0438 \u043d\u0435\u043f\u0440\u043e\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0442\u043e\u043b\u0431\u0446\u0430\u0445.<br \/>  \u041e\u0434\u0438\u043d \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u044f\u0432\u043d\u043e \u2014 \u044d\u0442\u043e \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447.<\/p>\n<h5>\u041f\u043e\u0438\u0441\u043a \u043f\u043e \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c\u0443 \u043a\u043b\u044e\u0447\u0443<\/h5>\n<p>  \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043f\u043e\u0438\u0441\u043a \u0441\u0442\u0440\u043e\u043a\u0438 \u043f\u043e \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c\u0443 \u043a\u043b\u044e\u0447\u0443, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044f \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0441\u0442\u0440\u043e\u043a\u0438 \u0438\u0437 \u0434\u0435\u0441\u044f\u0442\u0438 \u0442\u044b\u0441\u044f\u0447:  <\/p>\n<pre><code class=\"sql\">SELECT &quot;name&quot;, &quot;description&quot; FROM &quot;maintable&quot; WHERE &quot;ID&quot; = 3823; <\/code><\/pre>\n<p>\u0412\u0440\u0435\u043c\u044f, \u0437\u0430\u0442\u0440\u0430\u0447\u0435\u043d\u043d\u043e\u0435 \u043d\u0430 \u043f\u043e\u0438\u0441\u043a: <b>1,523 \u0441\u0435\u043a\u0443\u043d\u0434\u044b<\/b>.<br \/>  \u041f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0437\u0430\u0442\u0440\u0430\u0442\u0438\u043b <b>0,9 \u0441\u0435\u043a\u0443\u043d\u0434\u044b<\/b>, \u0430 \u0442\u0440\u0435\u0442\u0438\u0439 \u2014 <b>0,1 \u0441\u0435\u043a\u0443\u043d\u0434\u044b<\/b>.<\/p>\n<p>  \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0432\u0442\u043e\u0440\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0441 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0441\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c\u044e \u0438\u0437 \u044d\u0442\u043e\u0439 \u0436\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b:  <\/p>\n<pre><code class=\"sql\">SELECT &quot;name&quot;, &quot;description&quot; FROM &quot;maintable&quot; WHERE &quot;ID&quot; BETWEEN 5000 AND 6000; <\/code><\/pre>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0437\u0430\u0442\u0440\u0430\u0442\u0438\u043b <b>0,3 \u0441\u0435\u043a\u0443\u043d\u0434\u044b<\/b>, \u0432\u0442\u043e\u0440\u043e\u0439 \u2014 <b>0,26 \u0441\u0435\u043a<\/b>., \u0442\u0440\u0435\u0442\u0438\u0439 \u2014 <b>0,25 \u0441\u0435\u043a<\/b>.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a \u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u043c\u0438\u043b\u043b\u0438\u043e\u043d \u0437\u0430\u043f\u0438\u0441\u0435\u0439. \u041f\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c\u0443 \u043d\u043e\u043c\u0435\u0440\u0443 \u0441\u0442\u0440\u043e\u043a\u0438:  <\/p>\n<pre><code class=\"sql\">SELECT * FROM &quot;secondtable&quot; WHERE &quot;ID&quot; = 728472; <\/code><\/pre>\n<p>\u0412\u0440\u0435\u043c\u044f, \u0437\u0430\u0442\u0440\u0430\u0447\u0435\u043d\u043d\u043e\u0435 \u043d\u0430 \u043f\u043e\u0438\u0441\u043a: <b>1,4 \u0441\u0435\u043a<\/b>., \u0432\u0442\u043e\u0440\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e\u043a\u0430\u0437\u0430\u043b <b>1,36 \u0441\u0435\u043a.<\/b>. \u0414\u0430\u043b\u0435\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430.<\/p>\n<p>  \u0421\u0442\u043e\u043b\u0431\u0446\u044b \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0443\u0436\u0435 \u0438\u043c\u0435\u044e\u0442 \u0438\u043d\u0434\u0435\u043a\u0441, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f. \u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0441 \u0442\u0435\u043c\u0438 \u0436\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u044e\u0442 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u043e\u0438\u0441\u043a\u0430.<\/p>\n<h5>\u041f\u043e\u0438\u0441\u043a \u043f\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0443<\/h5>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u043e\u0438\u0441\u043a \u0442\u0435\u043a\u0441\u0442\u0430 \u043f\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0443 \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0438 \u043d\u0435\u043f\u0440\u043e\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u0430\u043c\u0438:  <\/p>\n<pre><code class=\"sql\">SELECT * FROM &quot;maintable&quot; WHERE &quot;name&quot; LIKE '\u043c\u043b%'; <\/code><\/pre>\n<p>\u0411\u0435\u0437 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u043a\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0437\u0430 <b>0,172 \u0441\u0435\u043a\u0443\u043d\u0434\u044b<\/b> \u0438\u0437 10 000 \u0441\u0442\u0440\u043e\u043a. \u0421 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c   <\/p>\n<pre><code class=\"sql\">CREATE NONCLUSTERED INDEX iName ON &quot;maintable&quot; (&quot;name&quot;) <\/code><\/pre>\n<p>\u0442\u0430\u043a\u043e\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0437\u0430 <b>0,112 \u0441\u0435\u043a\u0443\u043d\u0434\u044b<\/b>, \u0430 \u0441 <b>\u0441\u043e\u0441\u0442\u0430\u0432\u043d\u044b\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c<\/b>, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u043c \u043f\u043e\u043b\u044f \u00abname\u00bb \u0438 \u00abdescription\u00bb, \u0437\u0430\u043f\u0440\u043e\u0441 \u0437\u0430\u043d\u044f\u043b <b>0,09 \u0441\u0435\u043a\u0443\u043d\u0434\u044b<\/b>.<\/p>\n<p>  \u0417\u0430\u043f\u0440\u043e\u0441  <\/p>\n<pre><code class=\"sql\">SELECT * FROM &quot;maintable&quot; WHERE &quot;name&quot; LIKE '%dc%'; <\/code><\/pre>\n<p>\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0437\u0430 <b>0,172 \u0441\u0435\u043a\u0443\u043d\u0434\u044b \u0431\u0435\u0437 \u0438\u043d\u0434\u0435\u043a\u0441\u0430<\/b> \u0438 <b>0,112 \u0441\u0435\u043a\u0443\u043d\u0434\u044b \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c<\/b>.<\/p>\n<p>  \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0443 \u043a \u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0439 \u043c\u0438\u043b\u043b\u0438\u043e\u043d \u0437\u0430\u043f\u0438\u0441\u0435\u0439.  <\/p>\n<pre><code class=\"sql\">SELECT * FROM &quot;secondtable&quot; WHERE &quot;sname&quot; LIKE '\u044e\u0443\u0436%'; <\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 <b>\u0431\u0435\u0437 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u0438<\/b> \u0437\u0430\u043d\u044f\u043b \u0431\u044b \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c <b>1,7 \u0441\u0435\u043a\u0443\u043d\u0434\u044b<\/b>, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a <b>\u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c<\/b> \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0442\u0440\u0430\u0447\u0435\u043d\u043e <b>0,15 \u0441\u0435\u043a\u0443\u043d\u0434\u044b<\/b>.<\/p>\n<h5>\u041f\u043e\u0438\u0441\u043a \u043f\u043e \u0434\u0430\u0442\u0435<\/h5>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043c\u0430\u043b\u043e\u0439 \u0441\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438  <\/p>\n<pre><code class=\"sql\">SELECT * FROM &quot;secondtable&quot;  WHERE &quot;somedatetime&quot; BETWEEN '2012-26-11 11:30:00' AND '2012-26-11 11:32:00' <\/code><\/pre>\n<p><b>\u0411\u0435\u0437 \u0438\u043d\u0434\u0435\u043a\u0441\u0430<\/b> \u043e\u043d \u0437\u0430\u0439\u043c\u0451\u0442 \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c <b>0,7 \u0441\u0435\u043a<\/b>., <b>\u043f\u0440\u043e\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u2014 0,22 \u0441\u0435\u043a<\/b>.<\/p>\n<p>  \u0417\u0430\u043f\u0440\u043e\u0441 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0441\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 (420600 \u0441\u0442\u0440\u043e\u043a)  <\/p>\n<pre><code class=\"sql\">SELECT * FROM &quot;secondtable&quot;  WHERE &quot;somedatetime&quot; BETWEEN '2012-26-11 11:30:00' AND '2012-31-12 11:32:00' <\/code><\/pre>\n<p><b>\u0411\u0435\u0437 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u2014 19,219 \u0441\u0435\u043a<\/b>, <b>\u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c<\/b> \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u044f \u0434\u0430\u0442\u044b \u2014 <b>9,9 \u0441\u0435\u043a<\/b>.<\/p>\n<h5>\u0417\u0430\u043f\u0440\u043e\u0441 \u043f\u043e \u0434\u0430\u0442\u0435 \u043a \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u043e\u043c\u0443 \u0441\u0442\u043e\u043b\u0431\u0446\u0443<\/h5>\n<p>  <\/p>\n<pre><code class=\"sql\">SELECT * FROM &quot;secondtable&quot;  WHERE &quot;newdate&quot; BETWEEN '2012-26-11 11:30:00' AND '2012-31-12 11:32:00' <\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 <b>\u0431\u0435\u0437 \u0438\u043d\u0434\u0435\u043a\u0441\u0430<\/b> \u0437\u0430\u0439\u043c\u0435\u0442 <b>12,2 \u0441\u0435\u043a\u0443\u043d\u0434\u044b<\/b>, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a <b>\u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c \u2014 9,75<\/b>. \u0412\u0430\u0436\u043d\u043e \u0443\u0447\u0435\u0441\u0442\u044c \u0442\u043e, \u0447\u0442\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0441\u0442\u043e\u043b\u0431\u0435\u0446, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0434\u0430\u0442\u0443, \u0443\u0436\u0435 \u0431\u044b\u043b \u043f\u0440\u043e\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d.<\/p>\n<h5>\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446<\/h5>\n<p>  \u041f\u0440\u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0438 \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u043e\u0432\u0435\u0442\u0443\u044e\u0442 \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u043e\u043b\u0431\u0435\u0446, \u044f\u0432\u043b\u044f\u044e\u0449\u0438\u0439\u0441\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u043a\u043b\u044e\u0447\u043e\u043c. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0443\u0431\u0435\u0434\u0438\u043c\u0441\u044f, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0442\u0430\u043a.  <\/p>\n<pre><code class=\"sql\">CREATE NONCLUSTERED INDEX iFK ON &quot;secondtable&quot; (&quot;mainID&quot;); SELECT &quot;name&quot;, &quot;sname&quot;, &quot;somefirstnumber&quot;  FROM &quot;maintable&quot; M INNER JOIN &quot;secondtable&quot; S \tON M.&quot;ID&quot; = S.&quot;mainID&quot;  WHERE \tM.&quot;ID&quot; = 8271 <\/code><\/pre>\n<p>\u0422\u0430\u043a\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u0435\u0440\u043d\u0451\u0442 101 \u0441\u0442\u0440\u043e\u043a\u0443. <b>\u0411\u0435\u0437 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u2014 0,422 \u0441\u0435\u043a<\/b>, \u0430 <b>\u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c \u2014 0,122 \u0441\u0435\u043a<\/b>. \u041a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043b\u0430\u0441\u044c \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c \u0432 \u0442\u0440\u0438 \u0440\u0430\u0437\u0430. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435\u043c.<\/p>\n<p>  \u041d\u043e \u0438\u043d\u0434\u0435\u043a\u0441 \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0437\u0430\u043f\u0440\u043e\u0441 (420 000 \u0441\u0442\u0440\u043e\u043a)  <\/p>\n<pre><code class=\"sql\">SELECT &quot;name&quot;, &quot;sname&quot;, &quot;somefirstnumber&quot;  FROM &quot;maintable&quot; M INNER JOIN &quot;secondtable&quot; S \tON M.&quot;ID&quot; = S.&quot;mainID&quot;  WHERE \tS.&quot;somedatetime&quot; BETWEEN '2012-26-11 11:30:00' AND '2012-31-12 11:32:00'; <\/code><\/pre>\n<p>\u043f\u043e\u043a\u0430\u0437\u0430\u043b \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0431\u0435\u0437 \u0438\u043d\u0434\u0435\u043a\u0441\u0430, \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430, \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0438 \u0434\u0430\u0442\u044b, \u0441 \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u044b\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c, \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0438\u043c \u0432 \u0441\u0435\u0431\u044f \u044d\u0442\u0438 \u0434\u0432\u0430 \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u2014 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e <b>6,8 \u0441\u0435\u043a\u0443\u043d\u0434<\/b>.<\/p>\n<h5>\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u0438\u0441\u043a\u043e\u043c \u043f\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0443<\/h5>\n<p>  \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u0438\u0441\u043a\u043e\u043c \u043f\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0443 \u0441\u0440\u0435\u0434\u0438 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439:  <\/p>\n<pre><code class=\"sql\">SELECT &quot;name&quot;, &quot;sname&quot;, &quot;somefirstnumber&quot;  FROM &quot;maintable&quot; M INNER JOIN &quot;secondtable&quot; S \tON M.&quot;ID&quot; = S.&quot;mainID&quot;  WHERE \t&quot;sname&quot; LIKE '\u044e\u0443\u0436%'; <\/code><\/pre>\n<p><b>\u0411\u0435\u0437 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432<\/b> \u0437\u0430\u043f\u0440\u043e\u0441 \u0437\u0430\u0439\u043c\u0451\u0442 <b>0,766 \u0441\u0435\u043a\u0443\u043d\u0434\u044b<\/b> \u0438 \u0432\u0435\u0440\u043d\u0451\u0442 5 \u0441\u0442\u0440\u043e\u043a.<br \/>  \u0421 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u2014 <b>0,4 \u0441\u0435\u043a.<\/b>;<br \/>  \u0421 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u2014 <b>0,125 \u0441\u0435\u043a.<\/b>;<br \/>  \u0421 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u2014 <b>0,109 \u0441\u0435\u043a.<\/b>;<br \/>  \u0421 \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u044b\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u043c \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447 \u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 \u2014 <b>0,35 \u0441\u0435\u043a.<\/b>.<\/p>\n<h4>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432<\/h4>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432 \u0432\u0438\u0434\u0435 \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0432. \u0412\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u0430\u044f \u043e\u0441\u044c \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 <u>\u0437\u0430\u0442\u0440\u0430\u0447\u0435\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f<\/u> (<i>\u0430 \u043d\u0435 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c!<\/i>).<br \/>  1. \u0412\u044b\u0431\u043e\u0440\u043a\u0430 \u043f\u043e \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c\u0443 \u043a\u043b\u044e\u0447\u0443. \u0422\u0430\u043a \u043a\u0430\u043a \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0438 \u043c\u0430\u043b\u0443\u044e \u0441\u0435\u043b\u0435\u043a\u0442\u0438\u0432\u043d\u0443\u044e \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/198\/ce4\/6c5\/198ce46c5767e13a0c212d5b7585d934.png\"\/> <br \/>  \u0418\u0437 \u044d\u0442\u043e\u0433\u043e \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0432\u044b\u0431\u043e\u0440\u043a\u0430 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u0435\u0435.<\/p>\n<p>  2. \u041f\u043e\u0438\u0441\u043a \u043f\u043e \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c\u0443 \u043a\u043b\u044e\u0447\u0443 \u0441 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435\u043c \u0442\u0430\u0431\u043b\u0438\u0446. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0433\u0440\u0430\u0444\u0438\u043a \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0443\u0441\u043a\u043e\u0440\u044f\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u043f\u043e\u0438\u0441\u043a\u0430 \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c \u0432 \u0442\u0440\u0438 \u0440\u0430\u0437\u0430:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/d82\/f3d\/ccf\/d82f3dccf62a799a8bd7f2c746195c4b.png\"\/><\/p>\n<p>  3. \u041f\u043e\u0438\u0441\u043a \u043f\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0443 \u0442\u0435\u043a\u0441\u0442\u0430. \u0418\u0437 \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u043e \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437 \u0432\u044b\u0440\u0430\u0441\u0442\u0430\u0435\u0442, \u0435\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441 \u043f\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u043c \u043e\u0431\u044a\u0451\u043c\u0435 \u0434\u0430\u043d\u043d\u044b\u0445:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/be7\/ebf\/12a\/be7ebf12ad9e5ad5eaaeb5bd9daef7e4.png\"\/><\/p>\n<p>  4. \u041f\u043e\u0438\u0441\u043a \u043f\u043e \u0434\u0430\u0442\u0435. \u0418\u043d\u0434\u0435\u043a\u0441\u044b \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u044e\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a\u0430\u043a \u0434\u043b\u044f \u043c\u0430\u043b\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438, \u0442\u0430\u043a \u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/ed2\/ad1\/083\/ed2ad108350306b2e887774b28a4df2e.png\"\/><br \/>  \u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446 \u0438 \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u0434\u0430\u0442\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043a\u0430\u043a \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c\u0438, \u0442\u0430\u043a \u0438 \u0431\u0435\u0437 \u043d\u0438\u0445.<\/p>\n<p>  5. \u041f\u043e\u0438\u0441\u043a \u043f\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u043e\u043c\u0443 \u0441\u0442\u043e\u043b\u0431\u0446\u0443. \u0418\u043d\u0434\u0435\u043a\u0441 \u0442\u0430\u043a\u0436\u0435 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442 \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0438\u0441\u043a\u0430.<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/8e7\/116\/445\/8e711644585db89fce124d24a3065f03.png\"\/><\/p>\n<p>  6. \u041f\u043e\u0438\u0441\u043a \u043f\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0443 \u0441 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435\u043c. \u0418\u043d\u0434\u0435\u043a\u0441 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u0438 \u043e\u0431\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u044e\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/20a\/a76\/562\/20aa76562c774de6c8814fe5d0f816f6.png\"\/><\/p>\n<h4>\u041f\u043e\u0434\u0432\u0435\u0434\u0451\u043c \u0438\u0442\u043e\u0433\u0438<\/h4>\n<p>  \u041f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0432 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b, \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e:  <\/p>\n<ul>\n<li>\u0412\u043d\u0435\u0448\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0438 \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u044d\u0442\u043e \u0433\u0440\u043e\u0437\u0438\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438; <\/li>\n<li>\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u0442\u0435\u043a\u0441\u0442\u0430, \u0434\u0430\u0442\u044b, \u0447\u0438\u0441\u0435\u043b \u043f\u043e\u0432\u044b\u0448\u0430\u044e\u0442 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432; <\/li>\n<li>\u0418\u043d\u0434\u0435\u043a\u0441\u044b \u043b\u0443\u0447\u0448\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u043c\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u043e\u043a; <\/li>\n<li>\u0418\u043d\u0434\u0435\u043a\u0441\u044b \u043b\u0443\u0447\u0448\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043f\u0440\u0438 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u0442\u0440\u043e\u043a; <\/li>\n<li>\u0418\u043d\u0434\u0435\u043a\u0441\u044b \u0441\u043b\u0430\u0431\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u044b\u043c\u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u0430\u043c\u0438; <\/li>\n<li>\u0412 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044e\u0449\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447 \u0438 \u0441\u0442\u043e\u043b\u0431\u0435\u0446, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u043f\u043e\u0438\u0441\u043a; <\/li>\n<li>\u0418\u043d\u0434\u0435\u043a\u0441 \u043d\u0435 \u043f\u043e\u043c\u043e\u0436\u0435\u0442, \u0435\u0441\u043b\u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f WHERE \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u0442\u0430\u0431\u043b\u0438\u0446; <\/li>\n<li>\u041d\u0430 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u043d\u0435 \u0432\u043b\u0438\u044f\u044e\u0442. <\/li>\n<\/ul>\n<p>  \u0418\u0442\u0430\u043a, \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442 SELECT \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043e\u0434\u043d\u0430\u043a\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c \u0438 \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0441\u0442\u0440\u043e\u0435\u043d\u044b. \u041e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0438 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u044b \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0440\u0430\u0442\u044f\u0442 \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u043f\u043e\u0438\u0441\u043a \u0437\u043e\u043b\u043e\u0442\u043e\u0439 \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u044b, \u043a \u0442\u043e\u043c\u0443 \u0436\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c. \u041d\u043e \u0432\u0441\u0451 \u0436\u0435, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u043e \u043e\u0442\u0432\u0435\u0442, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0438\u043b\u0438 \u043d\u0435\u0442, \u043e\u0447\u0435\u0432\u0438\u0434\u0435\u043d. \t\t\t \t\t\t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/164717\/\"> http:\/\/habrahabr.ru\/post\/164717\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">\n<h4>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, <a href=\"http:\/\/ru.wikipedia.org\/wiki\/\u0418\u043d\u0434\u0435\u043a\u0441_(\u0431\u0430\u0437\u044b_\u0434\u0430\u043d\u043d\u044b\u0445)\">\u0438\u043d\u0434\u0435\u043a\u0441\u044b<\/a> \u043f\u043e\u0432\u044b\u0448\u0430\u044e\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0438\u043b\u0438 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u043e\u043c\u0443 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044e \u0432 \u043a\u043d\u0433\u0438\u0435. \u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u0442\u0435\u0439 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u0438 \u043f\u0430\u0440\u0443 \u0433\u043b\u0430\u0432 \u0438\u0437 \u043a\u043d\u0438\u0436\u0435\u043a, \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 SQL Server. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-164717","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/164717","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=164717"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/164717\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=164717"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=164717"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=164717"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}