Skip to content

Periodic table

The periodic table, isotopes and chemical formula molar masses as offline DuckDB SQL

Connector software
Free and open source
Service credentials
Not needed
Use with an agent

Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.

npx skills add Query-farm/vgi-skills --skill orchard

Copy this request into your coding agent to get started.

Use https://query.farm/products/orchard/connectors/elements/index.md to help me query Periodic table with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.

Symbols of the first ten elements

Example output · captured
Connector release
v0.2.0
Engine
2.0.1
VGI protocol
3.4.0
SELECT z, elements.main.element_symbol(z) AS symbol
FROM range(1, 11) t(z)
ORDER BY z
Result · first 5 rows
z symbol
1 H
2 He
3 Li
4 Be
5 B

Quick start

Choose where to run Periodic table, then follow the steps below.

The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.

1. Install the vgi extension

Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.

setup.sql
SET allow_extension_repositories = 'allowed';

CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
    WITH PREFIX 'https://duckdb-extensions.query.farm';

INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;

2. Attach the connector

Attach the release directly

Downloads the latest release for your platform and caches it locally.

ATTACH 'elements' AS elements (
  TYPE vgi,
  LOCATION 'github-auto://Query-farm/vgi-elements'
);

3. Run a query

query.sql
SELECT z, elements.main.element_symbol(z) AS symbol
FROM range(1, 11) t(z)
ORDER BY z
More example queries →
Technical details
Verified connector release
v0.2.0
Engine
2.0.1
VGI protocol
3.4.0
Verified on
December 1, 2026
Release notes on GitHub
Pin a version for production

When running the connector yourself, keep a specific release until you’re ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.

Attach the release directly

Uses the verified release each time you attach the connector.

ATTACH 'elements' AS elements (
  TYPE vgi,
  LOCATION 'github-auto://Query-farm/[email protected]'
);

Overview

The periodic table and NIST isotope data as offline DuckDB tables, with element lookups and chemical formula molar-mass and composition functions. No network or API key needed.

Catalog

Everything elements exposes once attached — read straight from the worker's released build.

elements 1 schema
main 2 tables · 6 functions

Periodic table and isotope reference tables, element lookup scalars and chemical formula functions.

Schema examples (10)
Examples (10)

Symbols of the first ten elements

SELECT z, elements.main.element_symbol(z) AS symbol
FROM range(1, 11) t(z)
ORDER BY z;
Result · first 5 rows
z symbol
1 H
2 He
3 Li
4 Be
5 B

Name of element 118

SELECT elements.main.element_name(118) AS name;

Normalize symbols to names

SELECT s, elements.main.element_name(s) AS name
FROM (VALUES ('fe'), ('AU'), ('Na')) t(s)
ORDER BY s;

Atomic mass of iron

SELECT elements.main.atomic_mass(26) AS iron;
6 more examples

Ratio of gold's atomic mass to silver's

SELECT elements.main.atomic_mass('Au') / elements.main.atomic_mass('Ag') AS gold_to_silver;

Atomic number of oganesson

SELECT elements.main.atomic_number('oganesson') AS z;

Molar masses of water, aspirin and copper sulfate pentahydrate

SELECT f, round(elements.main.formula_mass(f), 3) AS g_per_mol
FROM (VALUES ('H2O'), ('C9H8O4'), ('CuSO4·5H2O')) t(f)
ORDER BY f;

Moles of sodium chloride in one kilogram

SELECT round(1000 / elements.main.formula_mass('NaCl'), 2) AS mol_per_kg;

Mass percent of each element in aspirin

SELECT element, count, round(100 * mass_fraction, 2) AS mass_percent
FROM elements.main.formula_composition('C9H8O4')
ORDER BY mass_percent DESC;

Atom counts of copper sulfate pentahydrate

SELECT element, count
FROM elements.main.formula_composition('CuSO4·5H2O')
ORDER BY element;
Tables
elements 2 examples25 cols

All 118 chemical elements with atomic mass, position, electron configuration and physical properties; bundled offline from PubChem and NIST.

Columns
atomic_numbernot null INTEGER
Atomic number Z (proton count), 1-118. Primary key.
symbolnot null VARCHAR
IUPAC chemical symbol, case-sensitive ('Fe').
namenot null VARCHAR
English element name as published by PubChem ('Iron', 'Aluminum', 'Cesium').
atomic_massnot null DOUBLE
Atomic mass in g/mol (Da): see atomic_mass_basis. Fe = 55.845, C = 12.011 (conventional).
atomic_mass_basisnot null VARCHAR
Where atomic_mass comes from: 'standard_atomic_weight' (NIST value), 'conventional_atomic_weight' (IUPAC conventional value for interval elements) or 'longest_lived_isotope' (no stable isotopes).
standard_atomic_weight VARCHAR
NIST standard atomic weight as published: '55.845(2)' (uncertainty in last digits), an interval '[12.0096,12.0116]', or '[98]' (mass number of the longest-lived isotope); NULL when none is assigned.
atomic_weight_notesnot null VARCHAR[]
NIST/IUPAC footnotes on the atomic weight: 'g' geologically exceptional samples, 'm' modified isotopic compositions in commercial material, 'r' range in natural composition. Empty when none.
group_number INTEGER
IUPAC group 1-18 (derived from Z). NULL for the lanthanides (La-Lu) and actinides (Ac-Lr).
periodnot null INTEGER
Period (row) 1-7, derived from Z.
blocknot null VARCHAR
Periodic-table block 's', 'p', 'd' or 'f' (derived; La-Lu and Ac-Lr are 'f', matching group_number).
group_blocknot null VARCHAR
PubChem category: 'Alkali metal', 'Alkaline earth metal', 'Transition metal', 'Post-transition metal', 'Metalloid', 'Nonmetal', 'Halogen', 'Noble gas', 'Lanthanide' or 'Actinide'.
electron_configurationnot null VARCHAR
Ground-state electron configuration, e.g. '[Ar]4s2 3d6'.
electronegativity_pauling DOUBLE
Electronegativity on the dimensionless Pauling scale (fluorine 3.98); NULL where not measured.
atomic_radius_pm DOUBLE
Atomic (van der Waals) radius in picometres, as given by PubChem.
ionization_energy_ev DOUBLE
First ionization energy in electronvolts.
electron_affinity_ev DOUBLE
Electron affinity in electronvolts; NULL where unknown.
oxidation_states INTEGER[]
Common oxidation states (formal charge per atom, an integer count of electrons) as published by PubChem, e.g. [3, 2] for iron; NULL if none listed.
standard_statenot null VARCHAR
State at standard conditions: 'Solid', 'Liquid' or 'Gas' (expected state for superheavy elements).
properties_predictednot null BOOLEAN
True when PubChem marks the state or electron configuration as predicted/expected (superheavies).
melting_point_k DOUBLE
Melting point in kelvin.
boiling_point_k DOUBLE
Boiling point in kelvin.
density DOUBLE
Density in g/cm3 at standard conditions (gases too, so hydrogen is 0.00008988).
year_discovered INTEGER
Year of discovery; NULL for elements known since antiquity (see discovered_in_antiquity).
discovered_in_antiquitynot null BOOLEAN
True for elements PubChem lists as discovered in 'Ancient' times.
cpk_hex_color VARCHAR
CPK/Jmol molecular-model colour as 6 hex digits, e.g. 'E06633'; NULL if none.
ConstraintsUNIQUE (symbol) · UNIQUE (name) · PRIMARY KEY (atomic_number)
Examples (2)

The noble gases with their atomic masses

SELECT symbol, name, atomic_mass
FROM elements.main.elements
WHERE group_number = 18
ORDER BY atomic_number;

Element count and mean electronegativity per block

SELECT block, count(*) AS elements,
  round(avg(electronegativity_pauling), 2) AS avg_en
FROM elements.main.elements
GROUP BY block
ORDER BY block;
Link
isotopes 2 examples10 cols

Every nuclide in NIST's Atomic Weights and Isotopic Compositions table (3,352 isotopes) with relative atomic mass and natural abundance; bundled offline.

Columns
atomic_numbernot null INTEGER
Atomic number Z: count of protons in the nucleus; joins to elements.atomic_number.
symbolnot null VARCHAR
Element symbol (deuterium and tritium are listed under 'H').
mass_numbernot null INTEGER
Mass number A (protons + neutrons).
nuclidenot null VARCHAR
Nuclide label symbol-A, e.g. 'Fe-56', 'H-2'. Unique.
relative_atomic_massnot null DOUBLE
NIST relative atomic mass of the nuclide in u (Da).
relative_atomic_mass_uncertainty DOUBLE
Standard uncertainty of relative_atomic_mass in u; 0 for C-12, which is exact by definition.
relative_atomic_mass_estimatednot null BOOLEAN
True when NIST marks the mass '#' (estimated from systematic trends, not measured).
isotopic_composition DOUBLE
Representative terrestrial isotopic composition as a mole fraction 0-1; NULL when the nuclide has no representative natural abundance (most radioactive isotopes).
isotopic_composition_uncertainty DOUBLE
Standard uncertainty of isotopic_composition, in mole-fraction units (0-1); NULL when absent.
is_most_abundantnot null BOOLEAN
True for the isotope with the largest isotopic_composition of its element (false for elements with none).
ConstraintsUNIQUE (nuclide) · PRIMARY KEY (atomic_number, mass_number)
Examples (2)

Natural isotopes of carbon and their abundance

SELECT nuclide, isotopic_composition
FROM elements.main.isotopes
WHERE symbol = 'C' AND isotopic_composition IS NOT NULL
ORDER BY mass_number;

Elements with the most naturally occurring isotopes

SELECT e.symbol, count(*) AS natural_isotopes
FROM elements.main.isotopes i
JOIN elements.main.elements e USING (atomic_number)
WHERE i.isotopic_composition IS NOT NULL
GROUP BY e.symbol
ORDER BY natural_isotopes DESC, e.symbol
LIMIT 3;
Link
Scalar functions
atomic_mass (atomic_number BIGINT) +1 overload 2 examples

Atomic mass in g/mol (Da) for an atomic number: atomic_mass(26) returns 55.845

Arguments
atomic_number BIGINT
Atomic number (proton count) of the element. NULL, or a number with no element, gives NULL.
Overloads
atomic_mass(atomic_number BIGINT) → DOUBLEatomic_mass(symbol_or_name VARCHAR) → DOUBLE
ReturnsDOUBLE
Examples (2)

Atomic mass of iron

SELECT elements.main.atomic_mass(26) AS iron;

Ratio of gold's atomic mass to silver's

SELECT elements.main.atomic_mass('Au') / elements.main.atomic_mass('Ag') AS gold_to_silver;
Link
atomic_number (symbol_or_name VARCHAR) 1 example

Atomic number for a symbol or name, case-insensitive: atomic_number('iron') returns 26

Arguments
symbol_or_name VARCHAR
Element symbol ('Fe') or English name ('Iron'), case-insensitive; surrounding spaces are ignored. Unknown values give NULL.
ReturnsINTEGER
Example

Atomic number of oganesson

SELECT elements.main.atomic_number('oganesson') AS z;
Link
element_name (atomic_number BIGINT) +1 overload 2 examples

English element name for an atomic number: element_name(26) returns 'Iron'

Arguments
atomic_number BIGINT
Atomic number (proton count) of the element. NULL, or a number with no element, gives NULL.
Overloads
element_name(atomic_number BIGINT) → VARCHARelement_name(symbol_or_name VARCHAR) → VARCHAR
ReturnsVARCHAR
Examples (2)

Name of element 118

SELECT elements.main.element_name(118) AS name;

Normalize symbols to names

SELECT s, elements.main.element_name(s) AS name
FROM (VALUES ('fe'), ('AU'), ('Na')) t(s)
ORDER BY s;
Link
element_symbol (atomic_number BIGINT) 1 example

Chemical symbol for an atomic number: element_symbol(26) returns 'Fe'

Arguments
atomic_number BIGINT
Atomic number (proton count) of the element. NULL, or a number with no element, gives NULL.
ReturnsVARCHAR
Example

Symbols of the first ten elements

SELECT z, elements.main.element_symbol(z) AS symbol
FROM range(1, 11) t(z)
ORDER BY z;
Result · first 5 rows
z symbol
1 H
2 He
3 Li
4 Be
5 B
Link
formula_mass (formula VARCHAR) 2 examples

Molar mass in g/mol of a chemical formula: formula_mass('H2O') returns about 18.015

Arguments
formula VARCHAR
Chemical formula text: case-sensitive element symbols with whole-number subscripts, bracket groups and hydrate parts (see the function documentation for the syntax). Invalid formulas give NULL.
ReturnsDOUBLE
Examples (2)

Molar masses of water, aspirin and copper sulfate pentahydrate

SELECT f, round(elements.main.formula_mass(f), 3) AS g_per_mol
FROM (VALUES ('H2O'), ('C9H8O4'), ('CuSO4·5H2O')) t(f)
ORDER BY f;

Moles of sodium chloride in one kilogram

SELECT round(1000 / elements.main.formula_mass('NaCl'), 2) AS mol_per_kg;
Link
Table functions
formula_composition (formula VARCHAR) 2 examples

Break a chemical formula into elements with atom counts and mass fractions

Arguments
formula VARCHAR
Chemical formula text: case-sensitive element symbols with whole-number subscripts, bracket groups and hydrate parts (see the function documentation for the syntax). An invalid formula raises an error.
Returns columns
element VARCHAR
Element symbol.
atomic_number INTEGER
Atomic number.
count BIGINT
Atoms of the element per formula unit.
atomic_mass DOUBLE
Atomic mass in g/mol.
mass DOUBLE
count * atomic_mass in g/mol.
mass_fraction DOUBLE
Share of the formula mass, 0-1.
Examples (2)

Mass percent of each element in aspirin

SELECT element, count, round(100 * mass_fraction, 2) AS mass_percent
FROM elements.main.formula_composition('C9H8O4')
ORDER BY mass_percent DESC;

Atom counts of copper sulfate pentahydrate

SELECT element, count
FROM elements.main.formula_composition('CuSO4·5H2O')
ORDER BY element;
Link

Try these queries

Name of element 118

SELECT elements.main.element_name(118) AS name

Uses element_name

Normalize symbols to names

SELECT s, elements.main.element_name(s) AS name
FROM (VALUES ('fe'), ('AU'), ('Na')) t(s)
ORDER BY s

Uses element_name

Atomic mass of iron

SELECT elements.main.atomic_mass(26) AS iron

Uses atomic_mass

Atomic number of oganesson

SELECT elements.main.atomic_number('oganesson') AS z

Uses atomic_number

Molar masses of water, aspirin and copper sulfate pentahydrate

SELECT f, round(elements.main.formula_mass(f), 3) AS g_per_mol
FROM (VALUES ('H2O'), ('C9H8O4'), ('CuSO4·5H2O')) t(f)
ORDER BY f

Uses formula_mass

Mass percent of each element in aspirin

SELECT element, count, round(100 * mass_fraction, 2) AS mass_percent
FROM elements.main.formula_composition('C9H8O4')
ORDER BY mass_percent DESC

Uses elementsformula_composition

7 more examples in the Catalog, each listed under the table or function it uses.

Questions it can answer

Plain-English questions from the worker's agent test tasks. An AI agent with this catalog attached should answer each one with SQL.

  • Using the elements worker, what is the atomic mass of iron?
  • Using the elements worker, compute the molar mass of aspirin, C9H8O4, rounded to 2 decimals.
  • List the symbols of the noble gases (group 18) in order of atomic number.
  • Which naturally occurring isotopes of oxygen exist? Give mass number and isotopic composition, by mass number.
  • Map the free-text element values 'fe', 'GOLD' and 'na' to their atomic numbers, symbols and English names, ordered by atomic number.
  • What percentage of the mass of copper(II) sulfate pentahydrate (CuSO4·5H2O) is hydrogen? Round to 2 decimals.

Periodic table is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.