text: create StoreDB;
  
  
  create table Products
  (
  	ID int not null identity primary key,
  	Name nvarchar(100) not null,
  	Price money not null
  );
  go
  
  create table Customers
  (
  	ID int not null identity primary key,
  	Firstname nvarchar(100) not null,
  	Lastname nvarchar(100) not null,
  	CardNumber nvarchar(100) not null
  );
  go
  
  create table Orders
  (
  	ID int not null identity primary key,
  	ProductID int not null,
  	CustomerID int not null,
  	foreign key (ProductID) references Products(ID),
  	foreign key (CustomerID) references Customers(ID)
  );
  -- 1 Add three recodes into each table
  INSERT INTO Products (ID, Name,  Price)
  VALUES (1, 'tv', 200),
  VALUES (2, 'radio', 300),
  VALUES (3, 'laptop', 500);
  
  
  INSERT INTO Orders (ID, ProductId, CustomerId)
  VALUES (1, 1, 2)
  VALUES (2, 2, 3)
  VALUES (3, 2, 3);
  
  INSERT INTO Customers (ID, FirstName, LastName, CardNumber)
  VALUES (1, 'sofani', 'mesfun', 4545656 )
  VALUES (2, 'million', 'phil', 4545655 )
  VALUES (3, 'isaac', 'jack', 4545655);
  
  --2 add product iphone
  INSERT INTO Product (ID, Name,  Pricw)
  VALUES (4, 'iphone', 200);
  
  --3 Add Customer Tina Smith
  INSERT INTO Cumstomer (ID, FirstName,  LastName, CardNumber )
  VALUES (4, 'Tina', 'Smith', 608-89-99091);
  
  --4 Create order for Tina Smith bought an iphone
  select t1.Firstname, t1.Lastname, t3.Name
  from Orders as t2
  inner join Customers as t1
  on t1.ID=t2.CustomerID
  inner join Products as t3
  on t2.ProductID=t3.ID
  where t1.Firstname='Tina' and t1.Lastname='Smith';
  
  
  
  --5 report all orders by Tina Smith
  SELECT Orders.PruductId from Orders
  left join Customer
  where where Orders.CustomerId = 4;
  
  
  
  --6 report all revenue generated by sales of iphone
  SELECT SUM(price) AS "revanue generated"
  FROM Product;
  --7 increase saprice of an IPhone 250
  
  UPDATE Products 
  SET price = 250 
  WHERE Products.ID = 4;
  
  