998
APPX
Appendix 14 List of Available SQL Commands for CPU Module Database Access Function
Data Operation
INSERT
This command adds a record to the specified table in the database.
*1 Input null not to store the field value.
*2 When the field value is a character string, enclose it in single quotation marks (').
■
Application example
• To add records to all fields
INSERT INTO "table1" VALUES (11, null, 'abc');
• To add records to the specified fields
INSERT INTO "table1" ("fld1", "fld3") VALUES (12, 'efg');
SELECT
This command outputs a value of the specified record from the specified table in the database.
■
Option 1
■
Option 2
*1
*1 Multiple options can be used.
■
Application example
• To output all record values in table1 (all fields of table1)
SELECT * FROM table1;
• To output all record values in table1 (fld1 and fld2 in table1)
SELECT "fld1", "fld2" FROM table1;
• To output all records excluding the overlapped records in fld1 of table1
SELECT DISTINCT "fld1" FROM table1;
Syntax
• To add records to all fields
INSERT INTO [table name] VALUES (field 1 value, field 2 value,
, field X value);
• To add records to the specified fields
INSERT INTO [table name] (field specification 1, field specification 2,
, field specification X) VALUES (field 1 value, field 2 value,
, field X value);
Syntax
• To output all values
SELECT [output target field or numeric expression] FROM [table name] [option];
• To output a value excluding overlapped values
SELECT DISTINCT [output target field or numeric expression] FROM [table name] [option 1] [option 2];
Item
Description
Syntax
INNER JOIN
Performs inner join. (Records that exist in the specified both
tables are output.)
SELECT [output target field or numeric expression] FROM [table name
1] INNER JOIN [table name 2] ON [combining condition];
LEFT JOIN
Performs outer join. (All records that exist in [table name 1]
are output.)
SELECT [output target field or numeric expression] FROM [table name
1] LEFT JOIN [table name 2] ON [combining condition];
RIGHT JOIN
Performs outer join. (All records that exist in [table name 2]
are output.)
SELECT [output target field or numeric expression] FROM [table name
1] RIGHT JOIN [table name 2] ON [combining condition];
FULL JOIN
Performs outer join. (All records that exist in both of specified
tables are output.)
SELECT [output target field or numeric expression] FROM [table name
1] FULL JOIN [table name 2] ON [combining condition];
Item
Description
WHERE
Specifies the condition to obtain a specific record. (
GROUP BY
Specifies the grouping condition of the record to be obtained. (
HAVING
Specifies the condition to narrow down a search using the result of the aggregate function. (
ORDER BY
Specifies the sorting condition of the record to be obtained. (
Summary of Contents for MELSEC iQ-R-R00CPU
Page 2: ......
Page 151: ...9 MONITOR FUNCTION 9 1 Real Time Monitor Function 149 9 MEMO ...
Page 323: ...18 SEQUENCE SCAN SYNCHRONIZATION SAMPLING FUNCTION 321 18 MEMO ...
Page 330: ...328 20 ROUTING SETTING 20 3 Precautions MEMO ...
Page 423: ...26 BASIC CONCEPT 26 8 State Transition of the Redundant System 421 26 MEMO ...
Page 1014: ...1012 APPX Appendix 15 Added and Enhanced Functions MEMO ...
Page 1027: ......