Tags » SQL

​Posting 1.1 // Pengenalan Data Base - MySQL

Pada kali ini Sumbercode akan menjelaskan apa itu Data Base, Data Base yang akan SC ( Sumber Code ) jelaskan disini tentunya Database pada sistem aplikasi; 170 more words

Cara

Comparison and Logical Condition in SQL

Comparison Condition:-

Comparison conditions are used in conditions that compare one expression to another value or expression. These operator are used in WHERE condition.

Comparison Operator:- 214 more words

SQL

Sql, PL/SQL Special Query

Ques:-

TEAM RESULT

A        WIN

B        WIN

A        LOSS

A        WIN

B        DRAW

C        WIN

C        LOSS

D        LOSS

E        DRAW

EXPECTED OUTPUT

TEAM  WIN  LOSS DRAW… 950 more words

SQL

Availability Group Fail Over date/time - TSQL

I have been using this quick script to verify AG Status Change details from error log.

--


DECLARE @EndDate DATETIME = GETDATE() 
DECLARE @StartDate DATETIME = dateadd(dd,-31,GETDATE() )

exec xp_readerrorlog 0						-- 0=current SQL Server log
						,1						-- 1=SQL Server log, 2=SQL Agent log
						,N'The state of the local availability replica in availability group'					-- Search string
						,null					-- second search string
						,@StartDate			-- start date
						,@EndDate	-- end date
						,N'DESC'				-- order the logs by date

exec xp_readerrorlog 1						-- 0=current SQL Server log
						,1						-- 1=SQL Server log, 2=SQL Agent log
						,N'The state of the local availability replica in availability group'					-- Search string
						,null					-- second search string
						,@StartDate			-- start date
						,@EndDate	-- end date
						,N'DESC'				-- order the logs by date

exec xp_readerrorlog 2						-- 0=current SQL Server log
						,1						-- 1=SQL Server log, 2=SQL Agent log
						,N'The state of the local availability replica in availability group'					-- Search string
						,null					-- second search string
						,@StartDate			-- start date
						,@EndDate	-- end date
						,N'DESC'				-- order the logs by date

exec xp_readerrorlog 3						-- 0=current SQL Server log
						,1						-- 1=SQL Server log, 2=SQL Agent log
						,N'The state of the local availability replica in availability group'					-- Search string
						,null					-- second search string
						,@StartDate			-- start date
						,@EndDate	-- end date
						,N'DESC'				-- order the logs by date

exec xp_readerrorlog 4						-- 0=current SQL Server log
						,1						-- 1=SQL Server log, 2=SQL Agent log
						,N'The state of the local availability replica in availability group'					-- Search string
						,null					-- second search string
						,@StartDate			-- start date
						,@EndDate	-- end date
						,N'DESC'				-- order the logs by date

exec xp_readerrorlog 5						-- 0=current SQL Server log
						,1						-- 1=SQL Server log, 2=SQL Agent log
						,N'The state of the local availability replica in availability group'					-- Search string
						,null					-- second search string
						,@StartDate			-- start date
						,@EndDate	-- end date
						,N'DESC'				-- order the logs by date

--
SQL

Creating separate users for SQL Azure Databases

So you using Microsoft Azure to host a few databases. But want authentication separation across all the databases. There’s no UI to do this with, so here’s a script you can use to accomplish the task. 26 more words

SQL

Select from all tables on an Instance

We have all inherited less than desirable SQL Server Instances.  DBAs and Developers will both need to go through the countless databases, tables, SPs, etc. to get a handle of the situation.  149 more words

SQL SERVER

SQL/MySQL quick review

准备twitter OA的过程里多练习下SQL语句,顺便简单粗暴地学下MySQL。

一个简单快速的SQL v.s. MySQL 语法区别

when count(x) = 0, but need to print out 0. Use LEFT/RIGHT JOIN.

e.g. count (#students) = 0 group by dept_id —– dept_id’s table left join students table… 113 more words

Geeky