SQL 문법 작성 예제
`select id, name from category;`;
`select a.name, a.email, b.name as 'roleName' from user as a
left join role as b on a.roleId=b.id;`;
`select * from user where roleId is null;`;
`select * from content_category;`;
`select title from content join user on content.userId=user.id
where user.name='jiSungPark';`;
`select a.name from category as a join content_category as b
on a.id=b.categoryId join content as c on b.contentId=c.id
join user as d on c.userId=d.id where d.name='jiSungPark';`;
`select title,body,created_at from content join content_category as a
on content.id=a.contentId join category as b on a.categoryId=b.id
where b.name='soccer';`;
`select a.title,a.body,a.created_at,b.name from content as a
join user as b on a.userId=b.id join content_category as c
on a.id=c.contentId join category as d on c.categoryId=d.id
where d.name='soccer';`;
`select count(*) as 'ContentCount' from content as a join user as b
on a.userId=b.id where b.name='duRiCha';`;
`select user.name as name,count(content.userId) as ContentCount
from user left join content on content.userId=user.id
group by user.name;`;
`select user.name,count(content.userId) as ContentCount from content
right join user on content.userId=user.id group by user.name;`;