In the table SERVICE there is an EmployeeNumber attribute. This number is a secondary key in the SERVICE table but is a primary key in the TECHNICIAN table. Create a query that shows a list of service types, the date (can be just the year) the service was performed, and the name of the technician that performed the service. Order by employee name and then by date per employee name.
CREATE TABLE HOUSE
(HouseAddress CHAR(50),
HouseOwner CHAR(30),
Insurance CHAR(40));
INSERT INTO HOUSE
VALUES ('285 Westport Rd', 'John', 'Yes'),
('213 Longboard Ln', 'Josh', 'Yes'),
('321 Surf Rd', 'Marisol', 'No');
CREATE TABLE HEATINGUNIT
(HeatingUnitID INT,
UnitName CHAR(30),
UnitType CHAR(40),
Manufactory CHAR(40),
DateOfBuilt Date,
Capacity INT,
HouseAddress CHAR(50));
INSERT INTO HEATINGUNIT
VALUES (4, 'Large', 'Solar', 'GE', NULL, 3000, '213 Longboard
Lne'),
(3, 'Small', 'Electric', 'GE', NULL, 6000, '213 Longboard
Ln'),
(1, 'Small', 'Gas', 'LG', NULL, 2000, '285 Westport Rd'),
(2, 'Large', 'Solar', 'GE', NULL, 3500, '285 Westport Rd'),
(6, 'Medium', 'Hybrid', 'LG', NULL, 3000, '321 Surf Rd'),
(5, 'Medium', 'Hybrid', 'LG', NULL, 2000, '321 Surf Rd');
CREATE TABLE TECHNICIAN
(EmployeeNumber INT,
EmployeeName CHAR(30),
Title CHAR(40),
YearHired INT);
INSERT INTO TECHNICIAN
VALUES (1, 'John', 'Tech1', 2004),
(2, 'Jordan', 'Tech2', 2006),
(3, 'JohnAllen', 'Supervisor', 2015);
CREATE TABLE SERVICE
(HeatingUnitID INT,
ServiceType CHAR(40),
Date Date,
Time TimeSTAMP,
EmployeeNumber INT);
INSERT INTO SERVICE
VALUES (1, 'Repair', NULL, NULL, 1),
(2, 'Repair', NULL, NULL, 2),
(3, 'Maintenance', NULL, NULL, 2),
(4, 'Maintenance', NULL, NULL, 2);
Dear Student ,
As per the requirement submitted above , kindly find the below solution.
This demonstration is using SQL Server 2014.Database and tables are created using SQL Server Management Studio (SSMS).
Question :
SQL Query :
select ServiceType ,year(Date) as 'Date',EmployeeName as
'Technician Name'
from
service, TECHNICIAN
where
service.EmployeeNumber=TECHNICIAN.EmployeeNumber
order by EmployeeName,year(Date);
Screen in SSMS :

NOTE : PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.
In the table SERVICE there is an EmployeeNumber attribute. This number is a secondary key in...
CREATE TABLE HOUSE (HouseAddress CHAR(50), HouseOwner CHAR(30), Insurance CHAR(40), CREATE TABLE HEATINGUNIT (HeatingUnitID INT, UnitName CHAR(30), UnitType CHAR(40), Manufactory CHAR(40), DataOfBuilt Date, Capacity INT, HouseAddress CHAR(50)); CREATE TABLE TECHNICIAN (EmployeeNumber INT, EmployeeName CHAR(30), Title CHAR(40), YearHired INT); CREATE TABLE SERVICE (HeatingUnitID INT, ServiceType CHAR(40), Date Date, Time TIMESTAMP EmployeeNumber INT); INSERT INTO SERVICE VALUES...
CREATE TABLE Gender ( gender CHAR(1), description VARCHAR(10), PRIMARY KEY (gender) ); CREATE TABLE People ( ID INT, name VARCHAR(50), gender CHAR(1), height FLOAT, PRIMARY KEY (ID), FOREIGN KEY (gender) REFERENCES Gender (gender) ); CREATE TABLE Sports ( ID INT, name VARCHAR(50), record FLOAT, PRIMARY KEY (ID), UNIQUE (name) ); CREATE TABLE Competitions ( ID INT, place VARCHAR(50), held DATE, PRIMARY KEY (ID) ); CREATE TABLE Results ( peopleID INT NOT NULL, competitionID INT NOT NULL, sportID INT NOT NULL,...
Database Management
6. [5] Create the following table: CREATE TABLE customer ( cust_name VARCHAR(30) NOT NULL, address VARCHAR(60), UNIQUE (cust name, address)); A. Run the following inserts and explain why both work and how will you prevent it INSERT INTO customer VALUES ('Alex Doe', NULL); INSERT INTO customer VALUES ('Alex Doe', NULL); 7. [5] Modify the following table definition to ensure that all employees have a minimum wage of $10 CREATE TABLE employee ( empId INT PRIMARY KEY, empName VARCHAR(40)...
these are all tables please see the tables and
questions are mentioned below
please see that all and I need answers asap
please write proper answer it's an easy task and don't take much
time please do it fast
thanks in advance
EMPLOYEE Remark Column Name EmployeeNumberINT Primary Key Yes No CHAR (25 CHAR (35 CHAR 25 NUMERIC INT CHAR (12 CHAR Name in the DEPARTMENT table Position No Number in the EMPLOYEE table Su OfficePhone EmailAddress No No No...
SQL
I have a database
CREATE TABLE vendor
( vid CHAR(2) NOT NULL,
vname VARCHAR(25) NOT NULL,
PRIMARY KEY (vid) );
CREATE TABLE category
( catid CHAR(2) NOT NULL,
catname VARCHAR(25) NOT NULL,
PRIMARY KEY (catid) );
CREATE TABLE product
( pid CHAR(3) NOT NULL,
pname VARCHAR(25) NOT NULL,
price NUMERIC (7,2) NOT NULL,
vid CHAR(2) NOT NULL,
categoryid CHAR(2) NOT NULL,
PRIMARY KEY (pid));
CREATE TABLE region
( rid CHAR NOT NULL,
rname VARCHAR(25) NOT NULL,
PRIMARY KEY (rid)...
drop table department cascade constraints;
create table department (
Dname varchar2(15) not null,
Dnumber int not null,
Mgr_ssn char(9) not null,
mgr_start_date Date,
primary key (Dnumber),
Unique (Dname));
insert into DEPARTMENT values ('Research', '5', '333445555',
'22-May-1988');
insert into DEPARTMENT values ('Administration', '4', '987654321',
'01-Jan-1995');
insert into DEPARTMENT values ('Headquarters', '1', '888665555',
'19-Jun-1981');
drop table employee cascade constraints;
create table employee (
Fname varchar2(15) not null,
Minit char(1),
Lname varchar2(15) not null,
Ssn char(9),
Bdate date,
Address varchar2(30),
Sex char(1),...
CREATE TABLE Bill( bill_id char(15) PRIMARY KEY, bill_name VARCHAR(150) NOT NULL, dateOfVoteCommittee date, dateOfVote date, isPassed tinyint(1) CHECK (isPassed IN (0,1)), date_signed date, isVeto tinyint(1) CHECK (isVeto IN (0,1)), dateOfVote_override date, proposed_person_id INT, committee_id INT, foreign key(proposed_person_id) REFERENCES Congressman(person_id), foreign key(committee_id) REFERENCES Committee(committee_id) ); INSERT INTO Bill (bill_id, bill_name, dateOfVote, isPassed, date_signed, isVeto, dateOfVote_override, proposed_person_id, commitee_id) VALUES(1,'SB2 Florida Statutes',DATE'2019-03-27',1,DATE'2019-03-27',0,23,); *I am getting this error - mysql Mysql doesn't like the date entries in the insert statement. Schema above for reference.
Relation Students has schema: CREATE TABLE Students ( BannerID CHAR(9), stuName VARCHAR(40) NOT NULL, scholarship INT, PRIMARY KEY(BannerID)); The relation Students is currently empty. Develop a test that determines whether an insertion into Students is currently legal. Then apply your test to determine which of the following INSERT statements is allowable. a. INSERT INTO Students VALUES(950111333, ’John Smith’, 1000); b. INSERT INTO Students (BannerID, stuName) VALUES(‘950111333’, ’John Smith’); c. INSERT INTO Students VALUES(‘950111222’, NOT NULL,...
Question: Write one SQL statement for the following question: Return number of players whose rating is over 1000. Background information: This is a chess tournament management database that stores information about chess players, tournaments, sections, registrations, and pairings. Each player has an ID, name, grade (0 to 12) and rating. Each tournament has a number of sections. Each player can register for a section of a tournament In each round of a tournament, players in the same section will be...
Given (Oracle) SQL Script " CREATE TABLE Members( MemberID NUMBER(4) NOT NULL PRIMARY KEY, MFirst VARCHAR(25) NOT NULL, MLast VARCHAR(25) NOT NULL, Street VARCHAR(64) NOT NULL, City VARCHAR(25) NOT NULL, State VARCHAR(2) NOT NULL, ZipCode NUMBER(5) NOT NULL, CreditLimit NUMBER(7,2) NOT NULL, Gender VARCHAR(1) NOT NULL CHECK (Gender IN('F','M')) ); CREATE TABLE Employees( EmployeeID NUMBER(3) NOT NULL PRIMARY KEY, EFirst VARCHAR(25) NOT NULL, ELast VARCHAR(25) NOT NULL, ...