Replies: 1 comment
-
The schema for the above example is: struct Employee
{
int m_empno;
std::string m_ename;
std::string m_job;
std::optional<int> m_mgr;
std::string m_hiredate;
double m_salary;
std::optional<double> m_commission;
int m_deptno;
};
struct Department
{
int m_deptno;
std::string m_deptname;
std::string m_loc;
};
struct EmpBonus
{
int m_id;
int m_empno;
std::string m_received; // date
int m_type;
};
using namespace sqlite_orm;
auto storage = make_storage("SQLCookbook.sqlite",
make_table("Emp",
make_column("empno", &Employee::m_empno, primary_key(), autoincrement()),
make_column("ename", &Employee::m_ename),
make_column("job", &Employee::m_job),
make_column("mgr", &Employee::m_mgr),
make_column("hiredate", &Employee::m_hiredate),
make_column("salary", &Employee::m_salary),
make_column("comm", &Employee::m_commission),
make_column("deptno", &Employee::m_deptno),
foreign_key(&Employee::m_deptno).references(&Department::m_deptno)),
make_table("Dept",
make_column("deptno", &Department::m_deptno, primary_key(), autoincrement()),
make_column("deptname", &Department::m_deptname),
make_column("loc", &Department::m_loc)),
make_table("Emp_bonus",
make_column("id", &EmpBonus::m_id, primary_key(), autoincrement()),
make_column("empno", &EmpBonus::m_empno),
make_column("received", &EmpBonus::m_received),
make_column("type", &EmpBonus::m_type),
foreign_key(&EmpBonus::m_empno).references(&Employee::m_empno))); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The inner select (the one FROM takes its input) can be immediately solved today by the following:
What about the outer select? This is an example of a dynamic FROM!
Regards,
Juan Dent
Beta Was this translation helpful? Give feedback.
All reactions