vania-janet/multiturn-rag-retrieval-data huggingface dataset:
[where <where clause>]
...
[group by <group by list>]





 Description 



* <group by list>

Specifies a comma-delimited list of expressions that involves columns of the views in the from clause and scalar function calls. When you apply the group by clause, each group of tuples that shares common values for all group by expressions produces a single output tuple that is representative for the entire group.

A field or expression that does not appear in the group by clause cannot appear in the select list, unless it is used in an aggregate function call. The order of expressions in the list does not matter.

The group by clause treats all nulls as identical. Group by on a column with null values results in a single group.







 Examples 

Example 1: Computing aggregate values

Use the group by clause to compute aggregate values. This example counts the number of occurrences of each given name in the document. In this example, Count is an aggregate function.

create view SampleView as
select
GetText(P.firstname) as name,
Count(GetText(P.firstname)) as occurrences
from
(extract
dictionary 'first.dict'
on D.text as firstname
from Document D
) P
group by GetText(P.firstname);

In this case, first.dict is an external dictionary that contains the following entries:

Dictionary for given names
Aaron
Candra
Freeman
Matthew
Zoraida

The following steps describe semantics of this statement:



1. Group tuples that are produced by the subquery in the from clause by the text content of their firstname field.
2. For each group, count the number of tuples with a non-null firstname value. Produce a single output tuple for each such group, with two values, the name and the number of tuples in that group.



Example 2: Issues with grouping dissimilar fields

This example illustrates a statement that is not valid.

select GetText(P.firstname) as first,
GetText(P.lastname) as last,
To get a line with all the fields, you must export data from a custom view.
8. When you are finished, close the line.







 View a subset of the events by applying a timeframe 

In a view, you can search events that are displayed through a view for a specific timeframe.

You can apply a timestamp by specifying an absolute time, a relative time, or a time range.

Complete the following steps to jump to a specific time:



1. Launch the Log Analysis web UI.
2. Click the Views icon.
3. Select your custom view.
4. Enter a time query. Choose any of the following options:



* Enter a relative time such as 1 hour ago. Type ENTER

Zoom

![1 hour ago](https://cloud.ibm.com/docs-content/v1/content/f84e2238288b7f0355715a4c355609ce7ac48fb0/solution-tutorials/images/solution55-openshift-microservices/views-img-17.png)

1 hour ago
* Enter an absolute time to jump to a point in time in your events such as January 27 10:00am
* You can also enter a time range such as yesterday 10am to yesterday 11am, last fri 4:30pm to 11/12 1 AM, last wed 4:30pm to 23/05 1 AM, or May 20 10am to May 22 10am. Make sure to include to to separate the initial timestamp from the end timestamp





You might get the error message: Your request is taking longer than expected, try refreshing your browser after a few minutes of delay to allow logs to flow into the service. Also, ensure that the the timeframe selected is likely to have events available for display. It may be required to change the time query, and retry.





 Create a dashboard 

You can create a dashboard to monitor your app graphically through interactive graphs. For example, you can use graphs to analyze patterns and trends over a period of time.

Index fields are created on a regular schedule.
Connecting with mysql 

You can access your MySQL database directly from its command-line client, mysql. You can use mysql for direct interaction and monitoring of the data structures that are created within the database. It is also useful for testing and monitoring the queries and performance, installing and modifying scripts, and other management activities.

Set the admin password before you use it to connect to the database. For more information, see [Setting the Admin Password](https://cloud.ibm.com/docs/databases-for-mysql?topic=databases-for-mysql-admin-password).



 Installing mysql 

Install the command-line client for MySQL, mysql. To use mysql, the MySQL client tools need to be installed on the local system. They can be installed with the full MySQL package that is provided from [mysql.com](https://www.mysql.com/downloads/), or as a [package from your operating system's package manager](https://dev.mysql.com/doc/mysql-installation-excerpt/5.7/en/).

For more information about mysql, see the [MySQL documentation](https://dev.mysql.com/doc/refman/5.7/en/).





 mysql Connection Strings 

Connection strings are displayed in the Endpoints panel of your deployment's Overview, and can also be retrieved from the [cloud databases CLI plug-in](https://cloud.ibm.com/docs/databases-cli-plugin?topic=databases-cli-plugin-cdb-referencedeployment-connections), and the [API](https://cloud.ibm.com/apidocs/cloud-databases-apidiscover-connection-information-for-a-deployment-f-e81026).

The information that you need to make a connection with mysql is in the "cli" section of your connection strings.
With this function, you can write results, for example, into Parquet, without the need to provide column by column alias names in your SQL when your input data has columns with these characters. A typical situation is the existence of space () in input columns.

For example, you can use SELECT * FROM CLEANCOLS(cos://us-geo/sql/iotmessages STORED AS JSON) INTO cos://us-geo/mybucket/myprefix STORED AS PARQUET to produce a result set that can be stored as is into Parquet target format.

If you wrap your external table definition with the DESCRIBE table transformer, the table does not show its actual content but the schema that is inferred from the objects in IBM Cloud® Object Storage instead. With this function, you can explore the schema before you author your actual SQL statements against it.

When you use the DESCRIBE table transformer in your SQL statement, the default output format is JSON instead of CSV.

You can also wrap DESCRIBE around the other table transformers to explore the transformed table schema. However, you cannot wrap other table transformers around the DESCRIBE transformer.





 tableValuedFunction 

A table-valued function returns a relation, which is a set of rows. An example of a table-valued function is range(). For more information, see [SQL functions](https://cloud.ibm.com/docs/sql-query?topic=sql-query-sqlfunctionssqlfunctions).





 More topics - relation clause 

For more information about the clauses that are used in relation clauses, see the following topics:



* [booleanExpression](https://cloud.ibm.com/docs/sql-query?topic=sql-query-sql-referencebooleanExpression)
* [COSURI](https://cloud.ibm.com/docs/sql-query?topic=sql-query-sql-referenceCOSURI)
* [expression](https://cloud.ibm.com/docs/sql-query?topic=sql-query-sql-referenceexpression)
.db("orders")
.filter("example_design_doc/example_filter")
.build();

ChangesResult response =
service.postChanges(changesOptions).execute()
.getResult();

System.out.println(response);

const { CloudantV1 } = require('@ibm-cloud/cloudant');

const service = CloudantV1.newInstance({});

service.postChanges({
db: 'orders',
filter: 'example_design_doc/example_filter'
}).then(response => {
console.log(response.result);
});

from ibmcloudant.cloudant_v1 import CloudantV1

service = CloudantV1.new_instance()

response = service.post_changes(
db='orders',
filter='example_design_doc/example_filter'
).get_result()

print(response)

postChangesOptions := service.NewPostChangesOptions(
"$DATABASE",
)
postChangesOptions.SetFilter("example_design_doc/example_filter")

changesResult, response, err := service.PostChanges(postChangesOptions)
if err != nil {
panic(err)
}

b, _ := json.MarshalIndent(changesResult, "", " ")
fmt.Println(string(b))

The previous Go example requires the following import block:

import (
"encoding/json"
"fmt"
"github.com/IBM/cloudant-go-sdk/cloudantv1"
)



 Filter function req argument 

The req argument gives you access to aspects of the HTTP request by using the query property.

See the following example of supplying a req argument by using HTTP:
Any fields used in aggregations are also highlighted in the query results, but only the first aggregation operation is highlighted.





 10 May 2017 

New support for 'highlight' parameter : The query and notices methods now support the highlight parameter. The parameter is a boolean. When you run a query and specified highlight as true, the service returns output that includes a new highlight field in which words that match the query are wrapped in HTML * (emphasis) tags. See the [Query parameters](https://cloud.ibm.com/docs/discovery?topic=discovery-query-parametershighlight) for details.

Known issue when deleting an environment : It is possible for the deletion of an environment to complete only partially, resulting in a situation in which a new environment cannot be created because only a single environment per service instance is permitted. If you attempt to delete and then create an environment but see either operation stuck in the pending state, it is likely that you encountered this problem. To work around it, re-run the deletion operation to complete it, then create the new environment.





 8 May 2017 

Improved precision for emotion analysis and training dataset : Updated the emotion tone score model to improve precision on emotion analysis (docEmotion) enrichments. The training dataset was expanded and feature engineering was altered and as a result, the model has higher precision on the benchmark dataset.





 5 May 2017 

New beta support for entity normalization : Entity normalization is now available for use with the Discovery service that use a custom model generated by Watson Knowledge Studio. Entity normalization inserts normalized (canonical) names for different references to the same person or object in the source document. : Entity normalization is currently supported only as a beta capability. : [Resolved](https://cloud.ibm.com/docs/discovery?topic=discovery-release-notesdiscovery-30june2017)

Improved tooling error log : The Tooling error log is no longer limited to a maximum of eight (8) pages of results. The error log still displays the document ID if the document name is not available.

Update to configuration names : Configuration names are limited to 50 characters and must consist of the characters [a-zA-Z0-9-_].
For example, 'GMT+1' would yield '2017-07-14 03:40:00.0'.
: Example of an SQL function usage fragment

> SELECT from_utc_timestamp('2016-08-31', 'Asia/Seoul')
: Result value

2016-08-31 09:00:00





 get_json_object 

get_json_object(json_txt, path)
: Extracts a JSON object from path.
: Example of an SQL function usage fragment

> SELECT get_json_object('{"a":"b"}', '$.a')
: Result value

b





 greatest 

greatest(expr, ...)
: Returns the greatest value of all parameters, skipping null values.
: Example of an SQL function usage fragment

> SELECT greatest(10, 9, 2, 4, 3)
: Result value

10





 grouping 





 grouping_id 





 hash 

hash(expr1, expr2, ...)
: Returns a hash value of the arguments.
: Example of an SQL function usage fragment

> SELECT hash('Spark', array(123), 2)
: Result value

-1321691492





 hex 

hex(expr)
: Converts expr to hexadecimal.
: Example of an SQL function usage fragment

> SELECT hex(17)
: Result value

11
: Example of an SQL function usage fragment

> SELECT hex('Spark SQL')
: Result value

537061726B2053514C





 hour 

hour(timestamp)
: Returns the hour component of the string/timestamp.
: Example of an SQL function usage fragment

> SELECT hour('2009-07-30 12:58:59')
: Result value

12





 hypot 

hypot(expr1, expr2)
: Returns sqrt(expr1**2 + expr2**2).
: Example of an SQL function usage fragment
The command looks like:

curl -X POST https://api.{region}.databases.cloud.ibm.com/v5/ibm/deployments/{id}/remotes/promotion -H 'Authorization: Bearer <>' -H 'Content-Type: application/json' -d '{
"promotion": {
"version": "14",
"skip_initial_backup": false,
"dry_run": true
}
}'







 Changelog for Major PostgreSQL Versions 



* [PostgreSQL 10](https://www.postgresql.org/docs/10/release-10.html)
* [PostgreSQL 11](https://www.postgresql.org/docs/11/release-11.html)
* [PostgreSQL 12](https://www.postgresql.org/docs/current/release-12.html)
* [PostgreSQL 13](https://www.postgresql.org/docs/13/release-13.html)
* [PostgreSQL 14](https://www.postgresql.org/docs/14/release-14.html)
If you try to define a view and you do not define any of the following body parameters, query, hosts, apps, levels, tags, you can get the following error:

{"details":[{"message":""value" must contain at least one of query, hosts, apps, levels, tags]","key":"value"}],"error":""value" must contain at least one of [query, hosts, apps, levels, tags]","code":"BadRequest","status":"error"}





 Getting views 

When you retrieve all the views and alerts for the instance using the GET method, consider the following information:



* The GET method will return all configured views and associated alerts for the instance.
* The data returned can be imported into a different instance to create the same views and alerts in that instance.

If presets are defined, importing the data received from the GET method will fail. {: note







 Modifying views 

When you modify a view, consider the following information:



* You must specify the name and the view ID of the view.
* If you are viewing a view in the UI, the view is not refreshed automatically after you run an API request to modify the view. To refresh the view in the UI, you must navigate to the Everything view and back to the view.



An API request to modify a view replaces the existing view definition and associated alerts with your request body data. Any properties that are not specified in your PUT request will be removed.

If the viewid that you are trying to modify does not exist, a response similar to the following will be returned:

{"error":"Nothing to configure","code":"BadRequest","status":"error"}





 Deleting views 

When you delete a view, consider the following information:



* You must specify the ID of the view that you plan to delete.
* You delete the view and all the alerts that are configured for the view.









 API methods 

The following table outlines the actions that you can run to manage views and alerts programmatically:



Table 1. Configuration API endpoints
Tables 

In the table from the Tables tab, the value that is displayed in the row count column is an approximate. The exact row count is available after you run the GENERATE STATISTICS ON <table_name> command.



 Creating tables 



1. Go to Databases.
2. Select the database in which you want to create a table.
3. Select the schema in which you want to create a table.
4. Ensure that you are in the DB Objects > Tables tab.
5. Click Create table.
6. Type a name for the table.
If the name contains special characters, enclose it in double quotation marks. The dot character (".") is not supported.
You can select a name that has up to 128 characters. The name must begin with a letter or an underscore and can't contain embedded spaces. The name must be unique.
7. Optional: Specify the retention time interval (in days) for the table.
You can select between 1 day and up to 99 days, or zero to alter a temporal table to nontemporal.
8. Add columns to the table:



1. In the Columns section, under Name, type a name for the column. The name must start with a letter.
2. Select your column type.
The data type restricts the type of data that can be stored in a column. For example, preventing entry of alphanumeric characters into a numeric field.
Data types also help sort data correctly and play a role in optimizing storage. For all these reasons, it is important to pick the appropriate data type.
3. Specify whether Not null is true or false.
A column that allows NULL values also allows rows to be inserted with no value in that column. A column that does not allow NULL values does not accept rows with no value.
4. Specify the default value to be used if no value is specified when a row is inserted.
5. In the Distribute on and Organize on sections, specify the distribution key for the table by selecting up to four columns.
The AQL compiler examines all AQL files of the module and determines the right order to compile all views, dictionaries, tables, and functions declared in the module.







 Usage notes 



* When the underlying AQL file is not located as part of a module (modular AQL) and is compiled in compatibility mode, this statement is not supported.
* Circular dependencies between views are not allowed.
* AQL modules do not support submodules.
* AQL files within subfolders of the top-level module folder are ignored.







 Examples 

Example 1: Sample module

In the following example, the view TheMentions belongs to the module that is named sample.

module sample;

create dictionary GetTheDict as ('The', 'the');

create view TheMentions as
extract dictionary 'GetTheDict' on D.text as theMention
from Document D;







 The export statement 

The export statement in AQL is used to export an AQL object from the current module so that it can be imported and used in other modules.



 Syntax 

export view|dictionary|table|function <object-name>;





 Description 



* view|dictionary|table|function

Defines the type of object to export. The object type can be a view, dictionary, table, or function.
* <object-name>

Defines the name of the object to export. The <object-name> can be a simple identifier or a double-quoted identifier.







 Usage notes 



* You cannot export any of the imported AQL objects. You can create the effect of re-exporting the view or table in the current module by creating a new view:

select * from <imported_view_name_or_table_name>;
* The export view and output view statements that are shown in the examples are orthogonal to each other. In other words, an output view is not automatically an exported view, but it must be explicitly exported by using an export statement. An exported view is not automatically an output view, but it must be explicitly output by using the output view statement.
[Shows that the Title, Shortdesc, and url fields are selected and the preview search card is populated with information from those fields](https://cloud.ibm.com/docs-content/v1/content/a2b18c153837bce00a5b4de496e4b4ca64bbf56e/assistant-data/images/search-skill-configure-fields.png)

As you add field mappings, a preview of the search result is displayed with information from the corresponding fields of your data collection. This preview shows you what gets included in the search result response that is returned to users.

To get help with configuring the search, see [Troubleshooting](https://cloud.ibm.com/docs/assistant-data?topic=assistant-data-skill-search-addskill-search-add-troubleshoot).
4. Draft different messages to share with users based on the successfulness of the search.



Search result messages

 Field name Scenario Example message 

 Message Search results are returned I found this information that might be helpful: 
 No results found No search results are found I searched my knowledge base for information that might address your query, but did not find anything useful to share. 
 Error message I was unable to complete the search for some reason I might have information that could help address your query, but am unable to search my knowledge base at the moment. 



5. Specify the number of results to return.

The top three results are returned automatically. Can you choose to show fewer or more (up to 10) results in the response.

By default, customers can choose to see more results. If you don't want to give customers this choice, clear the Include link for customers to view up to 10 results checkbox.

This option was introduced with the 1.5.0 release.
6. Decide whether to be more selective with the answers that are returned.

By default, all search query matches, regardless of the confidence score of the match, are returned as search results. You can limit the search results to include only matches with a confidence score of 20% or higher in Discovery.
Using SQL Query 

IBM Cloud® Data Engine is a fully-managed service that lets you run SQL queries (that is, SELECT statements) to analyze, transform, or clean up rectangular data using the full ANSI SQL standard.

When you use the console to interact with your instance of IBM Cloud Object Storage, there are instances of IBM Cloud SQL Query automatically recognised in the new "Integrations" panel. You can also create new instances of IBM Cloud Data Engine directly from the "Integrations" panel in your browser. See Figure 1, showing the option to integrate services like Data Engine next to your credentials and buckets.

Zoom

![Integrations in COS](https://cloud.ibm.com/docs-content/v1/content/63322f2f3a72050206eb05ba7f590fdcb741105c/cloud-object-storage/images/integrate-from-cos.jpg)

Figure 1. Integrate SQL Query from COS instance

Select the card detailing the options and offering for IBM Cloud Data Engine. This is shown in Figure 2.

Zoom

![Integrate SQL Query](https://cloud.ibm.com/docs-content/v1/content/63322f2f3a72050206eb05ba7f590fdcb741105c/cloud-object-storage/images/integrate-with-sql.jpg)

Figure 2. Select the SQL Query card to integrate

Figure 3 shows the panel that opens when the card is selected. This panel give you control over the location and costs regarding your new instance of IBM Cloud Data Engine. Select the region appropriate for your buckets and the plan suitable for your projects. If you want more information you can use the documentation to [get started](https://cloud.ibm.com/docs/sql-query?topic=sql-query-overview).

Zoom

!
"document_id": "54f95ac0-3e4f-4756-bea6-7a67b2713c81",
"relevance": 1
},
{
"document_id": "01bcca32-7300-4c9f-8d32-33ed7ea643da",
"cross_reference": "my_id_field:1463",
"relevance": 4
}
]
}'
"{url}/v1/environments/a56dd9b4-040b-4ea3-a736-c1e7a467e191/collections/99040100-fe6a-4782-a4f5-28f9eee30850/training_data?version=2019-04-30"
Show more





 Adding an example to a training-data query 

After you create a training-data query, you can continue to add examples to it to improve the accuracy of the training. Use the POST /v1/environments/{environment_id}/collections/{collection_id}/training_data/{query_id} to add an example to an existing training-data query.

Perform the following steps to add an example to a training-data query.



1. Get the query ID of the training-data query to which you want to add a new example by [listing the collection's training-data queries](https://cloud.ibm.com/apidocs/discoverylist-training-data):

curl -u "4ba1624f-48b6-484a-8e32-18d1c205c1fa":"qUy3B0CbGf9G" "{url}/v1/environments/a56dd9b4-040b-4ea3-a736-c1e7a467e191/collections/99040100-fe6a-4782-a4f5-28f9eee30850/training_data?version=2019-04-30"