1
0
mirror of synced 2025-01-18 06:21:40 +03:00

code type is sql

This commit is contained in:
jackbravo 2007-09-06 16:17:49 +00:00
parent 0a68f3b5e6
commit 8c0ec95802

View File

@ -37,7 +37,7 @@ Consider three classes Permission, Role and RolePermission. Roles having many pe
Now adding autoincremented primary keys to these classes would be simply stupid. It would require more data and it would make the queries more inefficient. For example fetching all permissions for role 'Admin' would be done as follows (when using autoinc pks): Now adding autoincremented primary keys to these classes would be simply stupid. It would require more data and it would make the queries more inefficient. For example fetching all permissions for role 'Admin' would be done as follows (when using autoinc pks):
<code> <code type="sql">
SELECT p.* SELECT p.*
FROM Permission p FROM Permission p
LEFT JOIN RolePermission rp ON rp.permission_id = p.id LEFT JOIN RolePermission rp ON rp.permission_id = p.id
@ -47,7 +47,7 @@ SELECT p.*
Now remember sql JOINS are always expensive and here we are using two of those. When using natural identifiers the query would look like: Now remember sql JOINS are always expensive and here we are using two of those. When using natural identifiers the query would look like:
<code> <code type="sql">
SELECT p.* SELECT p.*
FROM Permission p FROM Permission p
LEFT JOIN RolePermission rp ON rp.permission_name = p.name LEFT JOIN RolePermission rp ON rp.permission_name = p.name