j. Create a SQL query based on tblTransaction and tblEmployees that will display all the fields from tblTransaction and the FirstName and LastName fields from tblEmployees. Use a join to include all employees, regardless if they have sold any products. Sort in ascending order by the employee’s first name and last name. Save your query as qryEmpTransaction_initialLastname, and then close the query. Feilds from tbl Transaction are TransactionID, CustomerID, EMployeeID, TransactionDate, MethodOfPayment
Feilds from tbl Employees are EmployeeID, FirstName, LastName, Address, City, State, Phone, Full time
SELECT tblEmployees.FirstName,
tblEmployees.LastName,tblTransaction.TransactionID,tblTransaction.CustomerID,
tblTransaction.EMployeeID,tblTransaction.TransactionDate,
tblTransaction.MethodOfPayment
FROM tblEmployees
LEFT JOIN tblTransaction
ON tblEmployees.EmployeeID= tblTransaction.EMployeeID
ORDER BY tblEmployees.FirstName ASC, tblEmployees.LastName ASC;
j. Create a SQL query based on tblTransaction and tblEmployees that will display all the fields...
Create a SQL query based on tblProducts and tblTransactionDetails that will display all the fields from tblProducts and the TransactionID and Quantity fields from tblTransactionDetails. Use a join to include all products, regardless of whether or not they have been purchased. Sort in ascending order by Brand. Save your query as qryTransactionDetails_initialLastn ame. tblTransactionDetails TransactionID ProductID Quantity 1 VZH159 2 2 EPP101 2 3 EOL672 3 4 VZH159 2 5 ZLE580 2 tblTransaction TransactionID CustomerID EmployeeID TransactionDate MethodOfPayment 1 11...
Create a new database and execute the code below in SQL Server’s query window to create the database tables. CREATE TABLE PhysicianSpecialties (SpecialtyID integer, SpecialtyName varchar(50), CONSTRAINT PK_PhysicianSpecialties PRIMARY KEY (SpecialtyID)) go CREATE TABLE ZipCodes (ZipCode varchar(10), City varchar(50), State varchar(2), CONSTRAINT PK_ZipCodes PRIMARY KEY (ZipCode)) go CREATE TABLE PhysicianPractices (PracticeID integer, PracticeName varchar(50), Address_Line1 varchar(50), Address_Line2 varchar(50), ZipCode varchar(10), Phone varchar(14), Fax varchar(14), WebsiteURL varchar(50), CONSTRAINT PK_PhysicianPractices PRIMARY KEY (PracticeID), CONSTRAINT FK_PhysicianPractices_ZipCodes FOREIGN KEY (ZipCode) REFERENCES Zipcodes) go CREATE...
Create a query to find all records in the tblCompany table in which the City field value starts with the letter H. Displayn all fields in the query recordset, and sort in ascending order by CompanyName. Save the query as qryHSelectedCities, run the query, and then close it.
WRITE A SQL QUERY SQL SERVER Write a SELECT statement that returns one column from the Customers table named FullName that joins the LastName and FirstName columns. -- Format this column with the last name, a comma, a space, and the first name like this: -- Doe, John -- Sort the result set by last name in ascending sequence. -- Return only the contacts whose last name begins with a letter from M to Z. -- ...
Currently working in SQL
For each manufacturerID, what is the least expensive product
price? Display the manufacturerID as well as a column with the
alias LeastExpensiveShoe. Sort the results from least
expensive to most expensive. This query does not require the
JOIN clause.
Product ProductID ProductName ManufacturerlD Category Color Price Description Manufacturer ManufacturerID ManufacturerName Address City State PostalCode Phone
Answer the following question in SQL: 6. Display employees’ LastName, FirstName and only the year value from each employee’s hire date SQL File: https://pastebin.com/tR98LUb3 Expert Answer
Create an SQL Query to show
how many customers there are in each state.
Sample results
ST CUST_COUNT
-- ----------
CA 1
GA 1
CO 2
DC 1
WA 4
BC 1
CUSTOMER CustomerlD ARTIST TRANS WORK SArtistID LastName PURCHASES/SOLD TO Q TransactionID ACQUIRED OworkID CREATES/CREATEDBY FirstName AreaCode LocalNumber Street City State ZipPostalCode Country Email (AK1.1) DateAcquired AcquisitionPrice DateSold SalesPrice AskingPrice WorkID (FK) CustomerlD (FK) Title (AK1.1) o- Copy (AK1.2) Medium Description ArtistID (FK) LastName (AK1.1) FirstName (AK1.1) Nationality DateOfBirth...
can someone solve these quick
please and thank you!
sql chapter 4
Query #1: List the company name, contact name, contact title and
the phone number for customers who HAVE NOT put in an order. Use an
outer join.
Query #2: Create a listing displaying the employee first name,
last name and the full name (First name space Last Name) of the
person they report to (Supervisor). This is a self-join. If an
employee does not report to anyone then...
SQL queries and procedures TABLE: Employees Business Rules: EmployeeID is defined as the primary key. Address has been denormalized to include City and State for performance reasons. DeptNbr is a foreign key that references DeptNbr in the Department table Manager is a foreign key that references EmployeeID in the Employees table Data Structure: (EmployeeId, LastName, FirstName, Street, City, State, Zip, DateOfHire, DateOfBirth, JobTitle, Salary, DeptNbr(fk), Manager(fk)) TABLE: Department Business Rules: DeptNbr is defined as the primary key. Data Structure: (DeptNbr,...
14. Write a query that lists the trip id, trip name and state
for all trips in New Hampshire. Run "Explain" against this query.
Now create an index on the state. Re-run your query and the
"Explain" Are there differences in the Explain results? Why or why
not?
Customer Customer Num LastName FirstName Address City State PostalCode Phone Reservation ReservationID TripID Trip Date Num Persons Trip Price Other Fees Customer Num Trip Guide TripID Guide Num LastName Trip Name Start...