> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-560f2a74.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Documentation for ClickHouse SQL Statements

# ClickHouse SQL Statements

export const SectionSearch = ({section = '/reference/statements', label = 'Statements', placeholder = 'Search this section...'}) => {
  const ref = useRef(null);
  useEffect(() => {
    const el = ref.current;
    if (!el || el.dataset.inkeepMounted === '1') return;
    window.__sectionSearchSeq = (window.__sectionSearchSeq || 0) + 1;
    const TARGET_ID = 'inkeep-section-search-' + window.__sectionSearchSeq;
    el.id = TARGET_ID;
    const KEY_STAGING = 'd3e2792740610240ff7bcf2c2a78a33012812eb4f3e34d54';
    const KEY_LOCAL = 'b25e5cf856ec9da60d250578b59dace8417359feeedcbc6b';
    const apiKey = (/\.mintlify\.app$/).test(window.location.hostname) ? KEY_STAGING : KEY_LOCAL;
    const EMBED = 'https://cdn.jsdelivr.net/npm/@inkeep/cxkit-js@0.5/dist/embed.js';
    const PREVIEW_HOST = 'private-7c7dfe99.mintlify.app';
    const PREVIEW_RE = new RegExp('^https?://' + PREVIEW_HOST.replace(/\./g, '\\.') + '/');
    const toPath = u => (u || '').replace(PREVIEW_RE, 'https://clickhouse.com/docs/').replace(/^https?:\/\/clickhouse\.com\/docs/, '').replace(/^https?:\/\/[^/]+/, '').replace(/[?#].*$/, '');
    const config = {
      baseSettings: {
        apiKey,
        organizationDisplayName: 'ClickHouse',
        primaryBrandColor: '#fdff75',
        transformSource: source => {
          let url = source.url || '';
          if (PREVIEW_RE.test(url)) url = url.replace(PREVIEW_RE, 'https://clickhouse.com/docs/');
          const path = toPath(url);
          const inSection = path === section || path.indexOf(section + '/') === 0;
          return Object.assign({}, source, {
            url,
            tabs: inSection ? [label] : []
          });
        },
        colorMode: {
          sync: {
            target: document.documentElement,
            attributes: ['class'],
            isDarkMode: a => (a && a.class || '').indexOf('dark') !== -1
          }
        },
        theme: {
          styles: [{
            key: 'hide-single-tab',
            type: 'style',
            value: '.ikp-ai-search-results__tab-list { display: none !important; }'
          }, {
            key: 'section-search-box',
            type: 'style',
            value: ['.ikp-ai-search-input-group {', '  border-radius: 6px;', '  background: var(--background-light, #ffffff);', '  box-shadow: 0 0 0 1px rgb(156 163 175 / 0.3);', '  padding-top: 0;', '  padding-bottom: 0;', '  min-height: 2.25rem;', '}', '.ikp-ai-search-input { min-height: 0; }', '.ikp-ai-search-results__list { margin-top: 0.5rem !important; }', '.ikp-ai-search-input-group:hover {', '  box-shadow: 0 0 0 1px rgb(75 85 99 / 0.3);', '}', '.dark .ikp-ai-search-input-group {', '  background: var(--background-dark, #151515);', '  box-shadow: 0 0 0 1px rgb(75 85 99 / 0.3);', '  filter: brightness(1.1);', '}', '.dark .ikp-ai-search-input-group:hover {', '  box-shadow: 0 0 0 1px rgb(107 114 128 / 0.3);', '  filter: brightness(1.25);', '}'].join('\n')
          }]
        }
      },
      searchSettings: {
        placeholder,
        debounceTimeMs: 300,
        maxResults: 20,
        shouldShowContentSnippets: true,
        contentSnippetLength: 200,
        shouldHighlightMatches: true,
        tabs: [label]
      }
    };
    let cancelled = false;
    let widget = null;
    const mount = () => {
      if (cancelled || el.dataset.inkeepMounted === '1') return;
      const api = window.__inkeepEmbedJs || window.Inkeep;
      if (!api || typeof api.EmbeddedSearch !== 'function') {
        requestAnimationFrame(mount);
        return;
      }
      el.dataset.inkeepMounted = '1';
      try {
        widget = api.EmbeddedSearch('#' + TARGET_ID, config);
      } catch (e) {
        console.log('Inkeep section search failed:', e);
      }
    };
    const loadEmbed = trap => {
      if (trap && !window.__inkeepTrapped) {
        const modalInkeep = window.Inkeep;
        try {
          Object.defineProperty(window, 'Inkeep', {
            configurable: true,
            get: function () {
              return modalInkeep;
            },
            set: function (v) {
              window.__inkeepEmbedJs = v;
            }
          });
          window.__inkeepTrapped = true;
        } catch (e) {}
      }
      if (!document.getElementById('inkeep-embed-js-script')) {
        const s = document.createElement('script');
        s.id = 'inkeep-embed-js-script';
        s.type = 'module';
        s.src = EMBED;
        document.head.appendChild(s);
      }
      mount();
    };
    let frames = 0;
    const waitForModal = () => {
      if (cancelled) return;
      if (window.__inkeepEmbedJs) {
        mount();
        return;
      }
      const modalReady = window.Inkeep && typeof window.Inkeep.ModalSearchAndChat === 'function';
      if (modalReady) {
        loadEmbed(true);
        return;
      }
      if (frames > 480) {
        loadEmbed(false);
        return;
      }
      frames++;
      requestAnimationFrame(waitForModal);
    };
    waitForModal();
    return () => {
      cancelled = true;
      try {
        if (widget && typeof widget.unmount === 'function') widget.unmount(); else if (widget && typeof widget.destroy === 'function') widget.destroy();
      } catch (e) {}
      if (el) el.dataset.inkeepMounted = '';
    };
  }, [section, label, placeholder]);
  return <div ref={ref} className="not-prose" style={{
    margin: '1.25rem 0'
  }} />;
};

Users interact with ClickHouse using SQL statements. ClickHouse supports common SQL statements like [SELECT](/reference/statements/select/index) and [CREATE](/reference/statements/create/index), but it also provides specialized statements like [KILL](/reference/statements/kill) and [OPTIMIZE](/reference/statements/optimize).

<SectionSearch section="/reference/statements" label="Statements" placeholder="Search SQL statements..." />
