IN SQL INNER JOIN 能否添加两个具有不同列的表?

IN SQL INNER JOIN can you add two tables with different columns?

嗨,我是 SQL 的新手。我正在尝试 select checkindate 和 checkout 列来自预订 table 以及来自客户 table 的名字和姓氏。两个 table 共享一个公共列,即 customerID。谁能帮帮我!!

Booking table:
bookingID (pk)
checkindate
checkoutdate 
customerID (fk)

Customer table:
customerID (pk)
firstname 
lastname
SELECT bt.customerid,checkindate,firstname ,lastname  
FROM BookingTable bt inner join CustomerTable ct 
     on bt.customerid=ct.customerid

您可以按如下方式使用内部联接:

SELECT B.customerid,
       B.checkindate,
       C.firstname ,
       C.lastname 
  FROM BookingTable b
  join CustomerTable c on b.customerid=c.customerid
SELECT booking.checkindate, booking.checoutdate, customer.firstname, customer.lastname
FROM booking 
JOIN customer 
ON booking.customerID = customer.customerID