gs gs116 SQL Server Beyond Relational - Hierarchies - Quiz No.1
gs gs116 Microsoft SQL Server Quiz
This quiz belongs to book/course code gs gs116 Microsoft SQL Server of gs organization. We have 100 quizzes available related to the book/course Microsoft SQL Server. This quiz has a total of 10 multiple choice questions (MCQs) to prepare and belongs to topic SQL Server Beyond Relational. NVAEducation wants its users to help them learn in an easy way. For that purpose, you are free to prepare online MCQs and quizzes.
NVAEducation also facilitates users to contribute in online competitions with other students to make a challenging situation to learn in a creative way. You can create one to one, and group competition on an topic of a book/course code. Also on NVAEducation you can get certifications by passing the online quiz test.
INSERT INTO Employees VALUES (1, 'Jeff Brown', NULL, hierarchyid::Root());
INSERT INTO Employees VALUES (1, 'Jeff Brown', NULL, hierarchyid::Get());
INSERT INTO Employees VALUES (1, 'Jeff Brown', NULL, hierarchyid::GetRoot());
INSERT INTO Employees VALUES (1, 'Jeff Brown', NULL, hierarchy::GetRoot());
CREATE TABLE H ( Node HierarchyID PRIMARY KEY CLUSTERED, NodeLevel AS Node.GetLevel(), ID INT UNIQUE NOT NULL, Name VARCHAR(50) NOT NULL )
CREATE TABLE H ( Node HierarchyID PRIMARY KEY NON CLUSTERED, NodeLevel AS Node.GetLevel(), ID INT UNIQUE NOT NULL, Name VARCHAR(50) NOT NULL )
CREATE TABLE H ( Node HierarchyID FOREIGN KEY CLUSTERED, NodeLevel AS Node.GetLevel(), ID INT UNIQUE NOT NULL, Name VARCHAR(50) NOT NULL )
CREATE UNIQUE bfs_index ON H (NodeLevel,Node)
CREATE UNIQUE INDEX bfs_index ON H (NodeLevel,Node)
CREATE INDEX bfs_index ON H (NodeLevel,Node)
CREATE UNIQUE INDEX bfs_index ON H (NodeLevel)
DECLARE @parent HierarchyId = HierarchyId::GetRoot() INSERT INTO H (Node,ID,Name) VALUES (@parent.GetDescendant(NULL,NULL),2,'Johnny')
DECLARE @parent HierarchyId = (SELECT Node FROM H WHERE Name = 'Thuru') DECLARE @parentNodeLevel int = (select NodeLevel from h where name = 'Thuru') SELECT Node.ToString() AS NodeText, * FROM H WHERE Node.IsDescendantOf(@parent) = 'TRUE' AND Node != @parent AND NodeLevel = @parentNodeLevel + 1
DECLARE @newParent HierarchyId = (SELECT Node FROM H WHERE name = 'Johnny') UPDATE H SET Node = Node.__________(Node.GetAncestor(1),@newParent) WHERE Name = 'S1'
DECLARE @child HierarchyId = (SELECT Node FROM H WHERE Name = 'S1') SELECT * FROM H WHERE Node = @child.GetAnces(2)
DECLARE @child HierarchyId = (SELECT Node FROM H WHERE Name = 'S1') SELECT * FROM H WHERE Node = @child.GetAncestor(2)
DECLARE @child HierarchyId = (SELECT Node FROM H WHERE Name = 'S1') SELECT * FROM H WHERE Node = @child.Ancestor(2)