Home  /  Questions  /  Question

50   50
Nov 05, 2016

Custom Column Pattern - SQL Design Patterns


I am not sure if this works or i misunderstood.

For Custom Column Pattern In Meta Model,  following SQLs have been mentioned to retrieve and display s student record.

1) SELECT Id, FirstName, LastName, Email FROM Student WHERE Id = 29

2) SELECT C.Name, V.Value FROM [Column] C JOIN [Value] V ON C.Id = V.ColumnId WHERE C.WhatId = 29

WhatId is a foreign key that points to a record in Student table which is identity column.

If we added custom columns for Course table, Id column in Course table will have value 29 and second query will get result for both tables (Student and Course).

Please advise.