04 October 2019

Common SQL Questions

.Write an SQL Query to find first weekday of the month?


SELECT 

DATENAME(dw, DATEADD(dd,  -DATEPART(dd, GETDATE()) + 1, GETDATE())) 

AS FirstDay

-----------------------------------------

A relationship in DBMS is the scenario where two entities are related to each other. In such a scenario, the table consisting of foreign key references to that of a primary key of the other table.


The different types of relationships in DBMS are as follows:
  • One-to-One Relationship –  Used when a single row in Table A is related to a single row in Table B.
  • One-to-Many Relationship – Used when a single row in Table A is related to many rows in table B.
  • Many-to-Many Relationship – Used when many rows in table A can be related to many rows in table B.
  • Self -Referencing Relationship – Used when a record in table A is related to record in same table.
----------------------------------------------------------------------------------------------------------------

A user-defined function is a function written as per the needs of the user by implementing logic. In these kinds of functions the user is not limited to pre-defined functions and simplify the complex code of predefined function by writing simple code. This function returns a scalar value or a table




.

CREATE FUNCTION samplefunc(@num INT)

RETURNS TABLE

AS

RETURN SELECT * FROM customers WHERE CustId=@num


SELECT * FROM samplefunc(10)

--------------------------------------------------------------------------------------------------------------------

Mention the differences between SUBSTR and CHARINDEX in SQL Server.
SUBSTRCHARINDEX 
Used to return a specific portion of the string in a given string
Used to return a character position in a given specified string
Example:SUBSTRING(‘Edureka’,1,4)
Output:Edur
Example:CHARINDEX(‘r’,’Edureka’,1)
Output:4

02 October 2019

SQL Interview Questions

https://www.gangboard.com/blog/sql-server-dba-interview-questions-and-answers

https://www.dbamantra.com/category/sql-server/

https://www.edureka.co/blog/interview-questions/sql-server-interview-questions/

--------------------------------------------------------------------------------------------------------------------











https://www.dbamantra.com/sql-server-dba-interview-questions-answers-sql-server-cluster-2/

https://docs.microsoft.com/en-us/sql/relational-databases/in-memory-oltp/survey-of-initial-areas-in-in-memory-oltp?view=sql-server-2017

https://www.sqlshack.com/sql-server-2014-columnstore-index/

https://www.dbamantra.com/sql-server-dba-interview-questions-answers-database-mirroring-1/

https://www.sqlshack.com/database-table-partitioning-sql-server/

https://www.springpeople.com/blog/performance-tuning-in-sql-server-tips-and-tricks/


SSRS
https://www.edureka.co/blog/interview-questions/power-bi-interview-questions/

https://www.gangboard.com/blog/ssrs-interview-questions/?utm_source=socials&utm_medium=fb&utm_campaign=iqa&utm_term=msbi&utm_content=kiruthika&fbclid=IwAR3k96LoljUqqD4yyR3CKFzBOY-iyHzjRW7iCJTOPxdoEhGZM1l3AOHHmro


SSIS

https://www.gangboard.com/blog/ssis-interview-questions-and-answers/

Resource Governor

Resource Governor  is a feature that you can use to manage SQL Server workload and system resource consumption. Resource Governor enables y...