--Q3 -- Find the First Name and Last name --All customers are listed in the Sales.Customers table --Person.peron table h
Posted: Fri May 20, 2022 5:39 pm
Please, Use JOINS commands! SQL
--Q3 -- Find the First Name and Last name --All customers are listed in the Sales.Customers table --Person.peron table has the names of everyone --for simplicity lets assume that Sales.Customers and Person person are related on customers.customerID = p.BusinessEntityID -- If a person is a customer select the customerID, if not levae it a blank --Q4 --Find the First Name and Last name of all persons who are not customers --All customers are listed in the Sales.Customers table --Person.peron table has the names of everyone --for simplicity lets assume that Sales.Customers and Person person are related on customers.customerID = p.Business EntityID --Q5 --Find the First Name and Last name of all persons who are not employees --All employees are listed in the Human Resources.Employees table --Person.peron table has the names of everyone --HumanResources. Employee and Person.person are related on BusinessEntityID
Human Resources.Employee Columns to BusinessEntityID (PK, FK, int, not NationalIDNumber (nvarchar(15 LoginID (nvarchar(256), not null) OrganizationNode (hierarchyid, 3. OrganizationLevel (Computed, s JobTitle (nvarchar(50), not null) Birth Date (date, not null) Marital Status (nchar(1), not null) Gender (nchar(1), not null) Hire Date (date, not null) | SalariedFlag (Flag(bit), not null) Vacation Hours (smallint, not nul SickLeave Hours (smallint, not nu CurrentFlag (Flag(bit), not null) rowguid (uniqueidentifier, not n ModifiedDate (datetime, not nu
Person. Person Columns * Business EntityID (PK, FK, int, not null) PersonType nchar(2), not null) NameStyle (NameStyle(bit), not null) Title (nvarchar(8), null) FirstName (Name(nvarchar(50)), not null) MiddleName (Name(nvarchar(50)), null) LastName (Name(nvarchar(50)), not null) Suffix (nvarchar(10), null) EmailPromotion (int, not null) Additional Contactinfo (XML(Person.Addi Demographics (XML(Person.Individualsu rowguid (uniqueidentifier, not null) ModifiedDate (datetime, not null)
Sales.Customer Columns - CustomerlD (PK, int, not null) - PersonlD (FK, int, null) on StorelD (FK, int, null) ow TerritoryID (FK, int, null) Account Number (Computed, varchar(10) rowguid (uniqueidentifier, not null) ModifiedDate (datetime, not null)
--Q3 -- Find the First Name and Last name --All customers are listed in the Sales.Customers table --Person.peron table has the names of everyone --for simplicity lets assume that Sales.Customers and Person person are related on customers.customerID = p.BusinessEntityID -- If a person is a customer select the customerID, if not levae it a blank --Q4 --Find the First Name and Last name of all persons who are not customers --All customers are listed in the Sales.Customers table --Person.peron table has the names of everyone --for simplicity lets assume that Sales.Customers and Person person are related on customers.customerID = p.Business EntityID --Q5 --Find the First Name and Last name of all persons who are not employees --All employees are listed in the Human Resources.Employees table --Person.peron table has the names of everyone --HumanResources. Employee and Person.person are related on BusinessEntityID
Human Resources.Employee Columns to BusinessEntityID (PK, FK, int, not NationalIDNumber (nvarchar(15 LoginID (nvarchar(256), not null) OrganizationNode (hierarchyid, 3. OrganizationLevel (Computed, s JobTitle (nvarchar(50), not null) Birth Date (date, not null) Marital Status (nchar(1), not null) Gender (nchar(1), not null) Hire Date (date, not null) | SalariedFlag (Flag(bit), not null) Vacation Hours (smallint, not nul SickLeave Hours (smallint, not nu CurrentFlag (Flag(bit), not null) rowguid (uniqueidentifier, not n ModifiedDate (datetime, not nu
Person. Person Columns * Business EntityID (PK, FK, int, not null) PersonType nchar(2), not null) NameStyle (NameStyle(bit), not null) Title (nvarchar(8), null) FirstName (Name(nvarchar(50)), not null) MiddleName (Name(nvarchar(50)), null) LastName (Name(nvarchar(50)), not null) Suffix (nvarchar(10), null) EmailPromotion (int, not null) Additional Contactinfo (XML(Person.Addi Demographics (XML(Person.Individualsu rowguid (uniqueidentifier, not null) ModifiedDate (datetime, not null)
Sales.Customer Columns - CustomerlD (PK, int, not null) - PersonlD (FK, int, null) on StorelD (FK, int, null) ow TerritoryID (FK, int, null) Account Number (Computed, varchar(10) rowguid (uniqueidentifier, not null) ModifiedDate (datetime, not null)