Project

General

Profile

Evolution #3366

Prefix Database tables columns names with table name ?

Added by Gregg C. about 7 years ago. Updated 11 months ago.

Status:
Commentaire
Priority:
Urgent
Assignee:
Category:
ORM
Target version:
Start date:
11/27/2013
Due date:
% Done:

0%

Estimated time:
Bdc:

Description

Example

Table User:
          -Id
          -Name
etc.

Would become

Table User:
          -UserId
          -UserName
etc.

Why?

While doing join query requests, when querying fields with the same name in different tables, we need to put aliases

If i do : "SELECT User.id, Image.id FROM User INNER JOIN Image" i won't be able to get the fields back. (Cursor.get("User.id") crash => can't prefix with table name)


Recurrences

History

#1Updated by Mickael G. about 7 years ago

use alias...

you can use :
  • column ("id")
  • table.column ("user.id")
  • alias ("user_id")
In select :
  • SELECT user.id as user_id FROM user

Also available in: Atom PDF

Go to top
Add picture from clipboard (Maximum size: 200 MB)