These tutorials show how to perform actions in FairCom's Control Center using SQL commands and the user interface.
Requirements:
- Ensure the FairCom server is installed and running.
- Confirm server access by running FairCom's Control Center.
Create a table
Both Create table procedures will create a table named "athlete". You can use either of these procedures to create this table.
Create a table using FairCom's Control Center
- Start the FairCom Control Center.
- Navigate to the Data tab.
- Select Tables from the Data menu.
- Click the Add Table button in the top right corner.
- Fill out the table information. For this tutorial, name the table
"athlete". - Add at least one field by defining the name and value and clicking the Add Field button.
- Click the Save button in the bottom right corner.
Create a table using SQL statements
- Start the FairCom Control Center.
- Navigate to the Data tab
- Select SQL Commands from the Data menu.
- Paste this code into the SQL Script Request editor:
create table "admin"."athlete" ( "id" bigint identity (1,1), "name" varchar(30), "ranking" smallint not null, "birthdate" date, "playernumber" numeric(32,6), "livedpast2000" bit, "earnings" money(32), "favoritesaying" varchar(500) );
- Click the Run button.
- Observe the Script results in the Execution Log.
- Select Tables from the Data menu.
- Observe the new table in the Tables list.
Insert records in a table
Insert records in a table using FairCom's Control Center
- Navigate to the Data tab.
- Select Tables from the Data menu.
- Click on the table name. For this tutorial, click the
"athlete"table. - Click the Add Record record button on the right side.
- Fill out the new record by defining the values of each field.
- Click the Add Record record button at the bottom of the window.
- Observe your new record in the table.
Insert records in a table using SQL statements
- Navigate to the Data tab
- Select SQL Commands from the Data menu.
- Paste this code into the SQL Script Request editor:
INSERT INTO "admin"."athlete" VALUES ('Michael Jordan', '1', '02/17/1963', '23', 1, '1700000000', 'There is no i in team but there is in win.'), ('Babe Ruth', '2', '02/06/1895', '3', 0, '800000', 'Every strike brings me closer to the next home run.'), ('Muhammed Ali', '3', '01/17/1942', '1', 1, '60000000', 'Float like a butterfly, sting like a bee.'), ('Pele', '4', '10/23/1940', '10', 1, '115000000', 'Everything is practice.'), ('Wayne Gretzky', '5', '01/26/1961', '99', 1, '1720000', 'You miss 100 percent of the shots you never take.'), ('Michael Schumacher', '6', '01/03/1969', '1', 1, '990000000', 'Once something is a passion, the motivation is there.');
- Click the Run button.
- Observe the Script results in the Execution Log.
Create an index on the "earnings" field
Create an index using FairCom's Control Center
- Navigate to the Data tab.
- Select Tables from the Data menu.
- Click on the table name. For this tutorial, click the
"athlete"table. - Click the Configuration button.
- Select the Indexes tab.
- Click the Add Index button on the right side.
- Fill out the Index Information including the Index Name and Index Keys.
- Click the Save and Close button.
- Observe the new index.
Create an index using SQL statements
- Navigate to the Data tab
- Select SQL Commands from the Data menu.
- Paste this code into the SQL Script Request editor:
create index "admin"."athlete_earnings_idx" on "admin"."athlete" ("earnings");
- Click the Run button.
- Observe the Script results in the Execution Log.
- Select Tables from the Data menu.
- Click on the table name. For this tutorial, click the
"athlete"table. - Click the Configuration button.
- Select the Indexes tab.
- Observe the new index.
View records
View records using FairCom's Control Center
- Navigate to the Data tab.
- Select Tables from the Data menu.
- Click on the table name. For this tutorial, click the
"athlete"table. - Observe the records.
View records using SQL statements
- Navigate to the Data tab
- Select SQL Commands from the Data menu.
- Paste this code into the SQL Script Request editor:
SELECT * FROM athlete;
- Click the Run button.
- Observe the Script results in the Execution Log.
Drop a table from a list
Both Drop table procedures will drop a table from a list. You can use either of these procedures to drop a table.
Drop a table using FairCom's Control Center
- Navigate to the Data tab.
- Select Tables from the Data menu.
- Click the three dot menu and click the Delete button.
Drop a table using a SQL statement
- Navigate to the Data tab
- Select SQL Commands from the Data menu.
- Paste this code into the SQL Script Request editor:
DROP TABLE athlete;
- Click the Run button.
- Observe the Script results in the Execution Log.
- Select Tables from the Data menu.
- Observe that the
athletetable is no longer listed.
Clone a table using FairCom's Control Center
- Navigate to the Data tab.
- Select Tables from the Data menu.
- Click the three dot menu and click the Duplicate button.
- Edit the table information for the new Copy of the table.
- Click the Save button.