| |
Sample Project
Tables in the example:
|
|
| |

|
|
| |
Player Table - We use all field types which ProCG supports in this
table. This is an example. |
|
|
| |
|
|
| |
| Name |
Type |
Length |
Nullable |
Auto Increment |
Codes Table |
Description |
| Id |
Integer |
|
|
|
|
|
| Name |
Char |
50 |
|
|
|
|
| Salary |
Float |
10,2 |
|
|
|
|
| PositionNum |
ShortInteger
|
|
|
|
|
|
| BirthDate |
Date
|
|
|
|
|
|
| TotalRevenue |
Integer 64
|
|
|
|
|
|
| Signature |
Binary |
100 |
|
|
|
|
| Address |
VarChar |
1000 |
|
|
|
|
| VC |
LongVarChar |
|
|
|
|
|
| SmallPhoto |
VarBinary |
1000 |
|
|
|
|
| BigPhoto |
LongVarChar |
|
|
|
|
|
| LevelNum |
ShortInteger |
|
|
|
Player Level |
|
|
|
| |
Player Keys
|
|
| |
| Name |
Unique |
Fields |
| Primary |
 |
Id |
|
|
| |
Player
Access Methods
|
|
| |
| Name |
Description |
| Player |
Get Player record by Id. |
|
SQL Command:
SELECT * FROM Player WHERE Id = :Player.Id
|
| NotInTeam |
Get All players not belong to any
team |
|
SQL Command:
SELECT DISTINCT P.* FROM Player P
WHERE P.Id not in (SELECT TP.PlayerId FROM TeamPlayer TP WHERE TP.PlayerId
= P.Id)
|
| AllPlayers |
Get All Players Order By Id. |
|
SQL Command:
SELECT * FROM Player ORDER BY Id
|
| SportPlayers |
Get All Players playing in specific
sport. Note: The sport is in the League table |
|
SQL Command:
SELECT DISTINCT P.* FROM Player P, TeamPlayer TP, Team T, League
L
WHERE TP.PlayerId = P.Id AND T.Id = TP.TeamId AND L.Id = T.LeagueId
AND L.Sport = :PlayerParams.Sport
|
| PlayerSports |
All sports this player plays. Note:
return only the sport code. |
|
SQL Command:
SELECT DISTINCT L.Sport FROM Player P, TeamPlayer TP, Team T, League
L
WHERE P.Id = :Player.Id AND TP.PlayerId = P.Id AND T.Id = TP.TeamId
AND L.Id = :T.LeagueId
|
| BetweenSalaries |
Get all players earn salary between
two values. Note: the values come PlayerParams structure. |
|
SQL Command:
SELECT P.* FROM Player P
WHERE P.Salary BETWEEN :PlayerParams.FromSalary AND :PlayerParams.ToSalary
ORDER BY P.Name
|
| CityPlayers |
Get all players from a specific
city. Note: The city code is in Team table and the parameter comes
from the Team record. |
|
SQL Command:
SELECT DISTINCT P.* FROM Player P, TeamPlayer TP, Team T
WHERE TP.PlayerId = P.Id AND T.Id = TP.TeamId AND T.City = :Team.City
|
| LeaguePlayers |
Get all players belong to specific
league. |
|
SQL Command:
SELECT DISTINCT P.* FROM Player P, TeamPlayer TP, Team T, League
L
WHERE TP.PlayerId = P.Id AND T.Id = TP.TeamId AND L.Id = :League.Id
|
| PlayerLeagues |
Get all Leagues players.. |
|
SQL Command:
SELECT DISTINCT L.* FROM Player P, TeamPlayer TP, Team T, League
L
WHERE P.Id = :Player.Id AND TP.PlayerId = P.Id AND T.Id = TP.TeamId
|
| PositionPlayers |
Get all positions players. |
|
SQL Command:
SELECT P.* FROM Player P
WHERE P.PositionNum = :Player.PositionNum
ORDER BY P.Name
|
|
|
| |
|
|
| |
Sates Table |
|
|
| |
|
|
| |
| Name |
Type |
Length |
Nullable |
Auto Increment |
Codes Table |
Description |
| Id |
Integer |
|
|
|
|
|
| Name |
Char |
50 |
|
|
|
|
|
|
| |
States Keys
|
|
| |
| Name |
Unique |
Fields |
| Primary |
 |
Id |
|
|
| |
States
Access Methods
|
|
| |
| Name |
Description |
| State |
Get State record by Id. |
|
SQL Command:
SELECT * FROM States WHERE Id = :States.Id
|
| AllPStates |
Get All States |
|
SQL Command:
SELECT * FROM States
|
|
|
| |
|
|
| |
City Table |
|
|
| |
|
|
| |
| Name |
Type |
Length |
Nullable |
Auto Increment |
Codes Table |
Description |
| StateId |
Integer |
|
|
|
|
|
| Id |
Integer |
|
|
|
|
|
| Name |
Char |
50 |
|
|
|
|
|
|
| |
City Keys
|
|
| |
| Name |
Unique |
Fields |
| Primary |
 |
StateId,Id |
|
|
| |
City Access
Methods
|
|
| |
| Name |
Description |
| City |
Get City by StateId and Id (City
Id). |
|
SQL Command:
SELECT * FROM City WHERE StateId = :City.StateId AND Id = :City.Id
|
| StateCities |
Get All States Cities |
|
SQL Command:
SELECT * FROM City WHERE StateId = :City.StateId
|
| AllCities |
Get All Cities order by StateId
and Id |
|
SQL Command:
SELECT * FROM City ORDER BY StateId, Id
|
|
|
| |
|
|
| |
League Table |
|
|
| |
|
|
| |
| Name |
Type |
Length |
Nullable |
Auto Increment |
Codes Tabulation |
Description |
| Id |
Integer |
|
|
|
|
|
| Name |
Char |
50 |
|
|
|
|
| Sport |
ShortInteger |
|
|
|
|
|
|
|
| |
League Keys
|
|
| |
| Name |
Unique |
Fields |
| Primary |
 |
Id |
|
|
| |
League
Access Methods
|
|
| |
| Name |
Description |
| League |
Get League record by Id. |
|
SQL Command:
SELECT * FROM League WHERE Id = :League.Id
|
|
|
| |
|
|
| |
Team Table |
|
|
| |
|
|
| |
| Name |
Type |
Length |
Nullable |
Auto Increment |
Codes Table |
Description |
| Id |
Integer |
|
|
|
|
|
| Name |
Char |
50 |
|
|
|
|
| StateId |
Integer |
|
|
|
|
|
| City |
Integer |
|
|
|
|
|
| LequeId |
Integer |
|
|
|
|
|
|
|
| |
Team Keys
|
|
| |
| Name |
Unique |
Fields |
| Primary |
 |
Id |
| LeagueTeams |
|
LequeId |
|
|
| |
Team Access
Methods
|
|
| |
| Name |
Description |
| Team |
Get Team record by Id |
|
SQL Command:
SELECT * FROM Team WHERE Id = :Team.Id
|
| AllPStates |
Get Leque teams |
|
SQL Command:
SELECT * FROM City WHERE LequeId = : Team.LequeId
|
|
|
| |
|
|
| |
Trainee Table |
|
|
| |
|
|
| |
| Name |
Type |
Length |
Nullable |
Auto Increment |
Codes Table |
Description |
| Id |
Integer |
|
|
|
|
|
| Name |
Char |
50 |
|
|
|
|
| PlayerId |
integer |
|
|
|
|
Reference to his trainer
(player) |
|
|
| |
Trainee
Keys
|
|
| |
| Name |
Unique |
Fields |
| Primary |
 |
Id |
|
|
| |
Trainee
Access Methods
|
|
| |
| Name |
DescriptionFields |
| Trainee |
Get Trainee record by Id. |
|
SQL Command:
SELECT * FROM Trainee WHERE Id = :Trainee.Id
|
| PlayerTrainees |
Get Players trainees |
|
SQL Command:
SELECT * FROM Trainee WHERE PlayerId = :Trainee.PlayerId
|
|
|
| |
|
|
| |
TeamPlayer Table - Uses as an intermediate table between Player and
Team |
|
|
| |
|
|
| |
| Name |
Type |
Length |
Nullable |
Auto Increment |
Codes Table |
Description |
| TeamId |
Integer |
|
|
|
|
|
| PlayerId |
Integer |
|
|
|
|
|
|
|
| |
TeamPlayer
Keys
|
|
| |
| Name |
Unique |
Fields |
| Primary |
 |
TeamId,PlayerId |
| PlayerTeams |
 |
PlayerId,TeamId |
|
|
| |
TeamPlayer
Access Methods
|
|
| |
| Name |
Description |
| SpecificTeamPlayer |
Get TeamPlayer record by TeamId
and PlayeId. |
|
SQL Command:
SELECT * FROM TeamPlayer WHERE TeamId = :TeamPlayer.TeamId AND
PlayerId = :TeamPlayer.PlayerId
|
| PlayerTeams |
Get Players teams |
|
SQL Command:
SELECT T.* FROM TeamPlayer TP, Team T
WHERE TP.PlayerId = :TeamPlayer.PlayerId AND T.Id = TP.TeamId
|
| TeamPlayers |
Get Teams players |
|
SQL Command:
SELECT P.* FROM Player P, TeamPlayer TP
WHERE TP.TeamId = :TeamPlayer.TeamId AND P.Id = TP.PlayerId
|
|
|
| |
Top |
|