Help Center/ AI DataLake/ devg/ Lance Development Guide/ Lance on Aura/ Querying and Writing Data to a Lance Table
Updated on 2026-11-06 GMT+08:00

Querying and Writing Data to a Lance Table

Querying a Lance Table

You can query data in a Lance table using the SELECT syntax. For details about the syntax, see SELECT.

Note:

Only the latest committed data can be queried.

Example:

1
2
SELECT * FROM lance_tbl;
SELECT a, b FROM lance_tbl WHERE a = 1;

Lance supports full-text search using indexes with Boolean operators. In the following example, content1 and content2 are columns that have full-text indexes defined on them.

Example:

1
2
3
4
5
SELECT * FROM lance_tbl WHERE content1@@ 'Index';
SELECT * FROM lance_tbl WHERE content1 @@ 'Search' AND content2 @@ 'index';
SELECT * FROM lance_tbl WHERE content1 @@ 'Arrow' OR content2 @@ 'fox';
SELECT * FROM lance_tbl WHERE content1 @@ 'fox' AND NOT content2 @@ 'lazy';
SELECT * FROM lance_tbl WHERE (content1 @@ 'fox' AND content1 @@ 'brown') OR content2 @@ 'python';

Writing Data to a Lance Table

You can insert one or more rows of data into a Lance table using the INSERT command. For details about the syntax, see INSERT.

Example:

1
2
3
INSERT INTO lance_tbl VALUES (1, 'a', 1.1234567, 100.11, '2025-03-03', '2025-03-03 16:00:00');
INSERT OVERWRITE INTO lance_tbl VALUES (1, 'b', 1.1234567, 100.11, '2025-03-03', '2025-03-03 16:00:00');
INSERT INTO lance_tbl (col1, col2, col3, col4, col5, col6) SELECT col1, col2, col3, col4, col5, col6 FROM lance_tbl2 WHERE col1 > 18;