Here we have the answer for above queries:
1.Ans:To add new column in table use alter command.
Alter table CUSTOMER_TABLE ADD SecondaryPhone number(20);
2.Ans:Use orderby for sorting purpose.
Select productname,productID,unitprice from PRODUCT_TABLE
order by productname;
3.Ans:To find Full address for Modern Homes we have to use where clause
Select customername,street,city,state,zipcode from CUSTOMER_TABLE where customername="Modern Homes";
4.Ans:To Find 16% increment in standard price we can perform algebric operation directly on column.
select productid,productname,standardprice,standardprice*1.16 As "standardprice_Incre" from PRODUCT_TABLE;
5.Ans: To calculate the average we have to use group function as AVG on standardprice.
select AVG(standardprice) from PRODUCT_TABLE where productfinish="Natural Ash";
6.Ans: We have to use alias for table here
select(t.standardprice - a.priceavg) AS "Difference"
from PRODUCT_TABLE t CROSS JOIN
(select AVG (standardprice)) As "priceavg"
from PRODUCT_TABLE)a;
data files: customer INSERT INTO CUSTOMER_TABLE VALUES ( 1,'Contemporary Furnitures','1355 S. Twilight Blvd.','Gainesville','FL','32601-2871' ); INSERT INTO...
Which orders have been placed since October 20, 2010?
I need SQL query OrderlD, OrderDate, CustomerlD 1001 21/Oct/10,1 1002, 21/Oct/10,8 1003, '22/Oct/10, 15 1004, '22/Oct/10, 5 1005, 24/Oct/10, 3 1006, '24/Oct/10, 2 1007, '27/Oct/10,11 1008, 30/Oct/10, 12 1009, '05/Nov/10,4 1010, '0S/Nov/10 1 End Table, Cherry,175, 1 2 Coffee Table, Natural Ash: 200,2 3 Computer Desk, Natural Ash 3752 Natural Ash. 375 Entertainment Center Natural Maple,650, 3 Desk, 'white 6, '8-Drawer Ash, 750,2 7. Dining Tabla Natural Ash,800, 2 'Computer Desk,...
Guidelines: The final project (Project 3) is an individual project. It requires writing an individual report and a presentation. Your manager at the VPF wants your help to answer the following questions and form your reply as a complete report. The report should be between 5 and 7 single spaced pages in addition to the cover page, table of contents, statement of Academic Honesty, reference page, and any other diagrams or appendices that will enhance your report. Note: Use the...
-- drop tables DROP TABLE REQUEST CASCADE CONSTRAINTS; DROP TABLE FULLORDER CASCADE CONSTRAINTS; DROP TABLE PRODUCT CASCADE CONSTRAINTS; DROP TABLE CUSTOMER CASCADE CONSTRAINTS; -- create and link tables CREATE TABLE CUSTOMER ( CustomerID INTEGER, Name VARCHAR2(40), City VARCHAR2(20), State CHAR(2), Zip CHAR(5), CONSTRAINT PK_CUSTOMER PRIMARY KEY (CustomerID) ); CREATE TABLE PRODUCT ( ProductID INTEGER, Description VARCHAR2(30), Material VARCHAR2(20), Price NUMBER(5,2), CONSTRAINT PK_PRODUCT...
-- drop tables DROP TABLE REQUEST CASCADE CONSTRAINTS; DROP TABLE FULLORDER CASCADE CONSTRAINTS; DROP TABLE PRODUCT CASCADE CONSTRAINTS; DROP TABLE CUSTOMER CASCADE CONSTRAINTS; -- create and link tables CREATE TABLE CUSTOMER ( CustomerID INTEGER, Name VARCHAR2(40), City VARCHAR2(20), State CHAR(2), Zip CHAR(5), CONSTRAINT PK_CUSTOMER PRIMARY KEY (CustomerID) ); CREATE TABLE PRODUCT ( ProductID INTEGER, Description VARCHAR2(30), Material VARCHAR2(20), Price NUMBER(5,2), CONSTRAINT PK_PRODUCT...
9 We want to find out the courses that each student is not enrolled in. Give a listing of the course descriptions, and the students (lname) who are not taking that specific course (Use a cartesian product and union it with a minus) drop table student_class; drop table student; drop table class; create table student ( ssn char(11) not null, lname varchar(40) not null, fname varchar(20) not null, phone char(12), address varchar(40), city varchar(20), state char(2), zip char(5), dob date,...
Please provide SQL command to provide the product names that customer number C0954327 ordered in January 2013 here is the database: CREATE DATABASE OrderEntryBMIS325 GO USE OrderEntryBMIS325 GO CREATE TABLE Customer ( CustNo CHAR(8), CustFirstName VARCHAR(20) CONSTRAINT CustFirstNameRequired NOT NULL, CustLastName VARCHAR(30) CONSTRAINT CustLastNameRequired NOT NULL, CustStreet VARCHAR(50), CustCity VARCHAR(30), CustState CHAR(2), CustZip CHAR(10), CustBal Decimal(12,2) DEFAULT 0, CONSTRAINT PKCustomer PRIMARY KEY (CustNo) ) INSERT INTO Customer (CustNo, CustFirstName, CustLastName, CustStreet, CustCity, CustState, CustZip, CustBal) VALUES ( 'C0954327','Sheri','Gordon','336 Hill St.','Littleton','CO','80129-5543',$230.00...
I need help for SQL homework.
the question:
the code for part 1,2:
drop table Customer;
drop table Company;
drop table Cruise;
drop table TravelAgent;
drop table Reservation;
drop sequence customerID_seq;
drop sequence cruiseID_seq;
drop sequence travelAgentID_seq;
drop sequence reservationID_seq;
create table Customer(
customerID number,
firstName varchar2(15),
lastName varchar2(15),
address varchar2(30),
phone number(10) not null,
age number(3),
Constraint Customer_PK Primary Key (customerID),
constraint Customer_unique unique (firstName,lastName,phone),
constraint Customer_check check(phone is not null)
);
create sequence customerID_seq
start with 1
increment...
DROP TABLE IF EXISTS customers; DROP TABLE IF EXISTS orders; DROP TABLE IF EXISTS order_details; DROP TABLE IF EXISTS items; DROP TABLE IF EXISTS artists; DROP TABLE IF EXISTS employees; -- create tables CREATE TABLE customers ( customer_id INT , customer_first_name VARCHAR(20), customer_last_name VARCHAR(20) NOT NULL, customer_address VARCHAR(50) NOT NULL, customer_city VARCHAR(20) NOT NULL, customer_state CHAR(2) NOT NULL, customer_zip CHAR(5) NOT NULL, customer_phone CHAR(10) NOT NULL, customer_fax CHAR(10), CONSTRAINT customers_pk...
2. The Vice President of Marketing for your firm wants the firm’s sales representatives to be able to directly view and edit customer details, but only for the state to which a particular sales representative is assigned. You have suggested that this need can be addressed with a view. For example, a view could be created for one particular state, and user account permissions for accessing that view granted only to sales representatives from that state. The VP has asked...
Use only a single SQL statement for each of the following questions 1 Give a listing of all the ssns,first names and the class descriptions of all the classes the students are taking. If there are no class _descriptions display 'No description is available yet'. (USE NVL) 2 Give a listing of only the lname and the class_code for students who are taking 'Introduction to C programming'. (Inner join) 3 Give a lising of all the class_descriptions and the number...