Given the default schema of a database: Customers 123 Customerld noe FirstName noc LastName Orders 123 Orderld OrderDate noc OrderNumber 123 Customerld 123 TotalAmount Orderltem 123 Itemid 123 Orderld 123 Productid 123 UnitPrice 123 Quantity noc City noc Country noc Phone Products 123 Productld se ProductName 123 Supplierld 123 UnitPrice Suppliers 123 Supplierld nc CompanyName noc ContactName noc ContactTitle noc City noc Country nc Phone noc Fax nc Package 123 IsDiscontinued To display the first name and last name of customers who have orders in 2020, which of the following tables are required in the FROM clause? Choose ALL that apply.
q8- Choose ALL that apply.


Required Code :-
show databases;
create database customerDB;
use customerDB;
-- --------------------TABLE - 1 -------------------------
create table Customers(CustomerId int , FirstName varchar(20) , LastName varchar(20) , City varchar(20) , Country varchar(20),
Phone varchar(10) , primary key(CustomerId)) ;
insert into Customers values(001 , 'subham' , 'kumar', 'mumbai' , 'india' , '9999999999'),
(002 , 'sekhar' , 'suman', 'delhi' , 'india' , '8978562343'),
(003 , 'suman' , 'shree', 'pune' , 'india' , '1111111111'),
(004 , 'guru' , 'dev', 'lucknow' , 'india' , '2222222222');
-- ---------------------TABLE - 2 -------------------------------------------------
create table Orders (OrderId int , OrderDate date , OrderNumber varchar(20) , CustomerId int , TotalAmount double ,
primary key(OrderId) , foreign key(CustomerId) references Customers(CustomerId));
insert into Orders values(101 , '2020-12-03', 'ABC1' , 001 , 456.23 ),
(102 , '2021-11-03', 'CDB2' , 002 , 33.13 ),
(103 , '2020-10-01', 'AAA2' , 004 , 67.23 );
-- -----------Query for Display the first name and last name of customers who have orders in 2020;
select c.FirstName , c.LastName from Customers c inner join Orders o on c.CustomerId = o.CustomerId where substring(o.OrderDate,1,4) = '2020';
---------------------------------------------------------------------------------------
The required tables in from clause are :-
1.> Customers Table
2.> Orders Table
Step by step
Solved in 2 steps with 2 images









