我有一个trip
表,其中包含from_city
和to_city
列,其中包含city
表的外键。
如何使用以city
作为主键的id
表进行联接,以便获得具有from_city_name
和to_city_name
的结果联接表?
答案 0 :(得分:1)
进行两次内部联接,如下所示。有关SQL连接的更多信息,请参见MySQL Join Made Easy For Beginners
#include <iostream>
using namespace std;
int main()
{
enum days { Sun, Mon, Tue, Wed, Thu,Fri,Sat };
int day;
cout << " Enter a day ";
cin >> day;
switch (day)
{
case 0:
cout << "Weekend" << endl;
break;
case 1:
cout << "Start of work week " << endl;
break;
case 2:
cout << "Midweek" << endl;
break;
case 3:
cout << "Midweek" << endl;
break;
case 4:
cout << "Midweek" << endl;
break;
case 5:
cout << "End of work week" << endl;
break;
case 6:
cout << "Weekend" << endl;
break;
default:
cout << "Invalid day of the week" << endl;
return 0;
}
}