1.
SELECT FirstName, LastName FROM Persons WHERE LastName like 'M%' ;
(SELECT is used to select the columns
FROM is used to mention the table name
WHERE is used to filter out the rows)
---------------------------------------------------------------------------------------------------------------------------------------------------------
2.
SELECT FirstName, LastName FROM Persons WHERE LastName NOT LIKE '%S%' ;
(SELECT is used to select the columns
FROM is used to mention the table name
WHERE is used to filter out the rows)
---------------------------------------------------------------------------------------------------------------------------------------------------------
3.
SELECT COUNT() FROM Persons WHERE Category = 'Cooking' ;
(The count(ISBN) function is used find the count of the rows filter)
Given the following table structure, write the SQL code to display all the first and last...
I need to write a SQL query that displays the first name and last name of each author along with the number of books he or she has written. Capitalize the first and last names. AUTHOR table: AUTHORID, LNAME, FNAME BOOKAUTHOR table: ISBN, AUTHORID BOOKS table: ISBN, TITLE, PUBDATE, PUBID, COST, RETAIL, DISCOUNT, CATEGORY
How would you list the title and publication date for each
book in the BOOKS table. Use the column heading “Publication Date”
for the Pubdate field? Using SQL.
Nane Null? Type ISBN TITLE PUBDATE PUBID COST RETAIL DISCOUNT CATEGORY NOT NULL VARCHAR2(10) VARCHAR2(30) DATE NUMBER(2) NUMBER(5,2) NUMBER(5,2) NUMBER(1,2) VARCHAR2(12)
Please help me on the SQL
queries, thank you so much.
Write a query to display the
title and publisher as well as the publisher contact for each book
using JOIN...USING clause.
Write a query to show the
first and last names of customers who have ordered cooking books.
Use the WHERE clause to join the tables.
Write a query to show the
title, cost and ISBN of each book in the books table. If the book
has been ordered,...
SQL Command - Create a view called S LIST that lists the Cardholder Number, last name, first name and due date for all cardholders who have not returned a book. Use the CREATE OR REPLACE VIEW AS ... command. TABLE CARD HOLDERS Cardholder Numberint NOT NULL CONSTRAINT CH PK PRIMARY KEY, First_Name varchar(10) NULL, LastName varchar(15) NULL, Address varchar(20) NULL, varchar(15) NULL, State char(2) NULL, Zip_Code char(5) NULL) City TABLE BOOKS CHECKED OUT Cardholder_Numberint NOT NULL, Book Numberint NOT NULL,...
Do these codes look right for the following 5 statements. This is using Oracle SQL: Write a query that displays the title, ISBN, and wholesale cost of books whose wholesale cost is more than the average of all books. Format the retail price with dollars and cents. Write a query that displays the title and publication date of the oldest book in the BOOKS table. Format the date with the complete name of the month and a comma after the...
The following SQL DDL script creates a database for a social network application. create table userProfile( id char(10) primary key, firstName varchar(20), lastName varchar(20), dob date, email varchar(30) ); create table foaf( userid char(10), friendID char(10), timeEstablished date, constraint pk primary key(userid, friendID), constraint fk1 foreign key(userid) references userProfile(id), constraint fk2 foreign key(friendID) references userProfile(id) ); create table activity( actID char(20) primary key, topic varchar(20), description varchar(100), location varchar(20), ActivityDate date, hostUser char(10), foreign key(hostUser) references userProfile(id) ); create table...
I need to create a SQL query that displays the names of the customers who purchased the book with the highest retail price in the database. Also I need to capitalize the first and last names. CUSTOMERS Table: CUSTOMER#, LASTNAME, FIRSTNAME, ADDRESS, CITY, STATE, ZIP, REFERRED, REGION, EMAIL ORDERS Table: ORDER#, CUSTOMER#, ORDERDATE, SHIPDATE, SHIPSTREET, SHIPCITY, SHIPSTATE, SHIPZIP, SHIPCOST ORDERITEMS Table: ORDER#, ITEM#, ISBN, QUANTITY, PAIDEACH
Write SQL Queries Given the following
tables
(7pts) Retrieve the names of employees and their
project name. If the employee never worked on a project, show the
names only the name, not the project name.
(7pts) Retrieve the names of employees who have worked
on the same project at a different location.
(7pts) Retrieve the names of employees who have worked
on more than two different projects.
(7pts) Retrieve the names of employees who manage more
than two employees.
CREATE...
/* I am executing following SQL statement for the below code but I am getting error. Pls, upload screenshot after running it. SQL Statement: SELECT OfferNo, CourseNo FROM Offering WHERE OfferTerm = 'Sum' AND OfferYear = 2012 AND FacSSN IS NULL; */ CREATE TABLE STUDENT( StdSSN INT NOT NULL PRIMARY KEY, StdFName VARCHAR2(50), StdLName VARCHAR2(50), StdCity VARCHAR2(50), StdState VARCHAR2(2), StdZip VARCHAR2(10), StdMajor VARCHAR2(15), StdYear VARCHAR2(20) ); CREATE TABLE FACULTY( FacSSN INTEGER NOT NULL PRIMARY KEY, FacFName VARCHAR(50), FacLName VARCHAR(50), FacCity...
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...