One place for hosting & domains

      CSSを使用して改行を防ぐ方法


      はじめに

      開発者は、通常、Webページでテキストを折り返すことを好みます。折り返しにより、何らかの方法でテキストが制約され、デザイン上の問題が回避されます。テキストの折り返しは、横方向のスクロールも防ぐことができます。しかし、長さに関係なく、テキストブロックを同じ行に残したい場合があります。CSSのwhite-spaceプロパティを使用して、特定の要素の改行とテキスの折り返しを防ぐことができます。

      このチュートリアルでは、同じテキストブロックを4つの異なる方法でスタイル設定します。1つ目は改行を使用し、後の3つは改行を使用せずに設定します。

      Medusafish banded killifish convict blenny saury threadsail beluga sturgeon. Indian mul mora cisco masu salmon, roosterfish requiem shark longnose lancetfish bluefish red snapper Sacramento splittail giant danio.

      Medusafish banded killifish convict blenny saury threadsail beluga sturgeon. Indian mul mora cisco masu salmon, roosterfish requiem shark longnose lancetfish bluefish red snapper Sacramento splittail giant danio.

      Medusafish banded killifish convict blenny saury threadsail beluga sturgeon. Indian mul mora cisco masu salmon, roosterfish requiem shark longnose lancetfish bluefish red snapper Sacramento splittail giant danio.

      Medusafish banded killifish convict blenny saury threadsail beluga sturgeon. Indian mul mora cisco masu salmon, roosterfish requiem shark longnose lancetfish bluefish red snapper Sacramento splittail giant danio.

      これにより、テキストを折り返すか、折り返さないかについて、いくつかのオプションが提供されます。

      前提条件

      このチュートリアルを実行するには、次のものが必要です。

      Step 1ー CSSでの改行の防止と強制

      このステップでは、3つの異なるクラスを持つスタイルシートを作成します。それぞれ異なる方法で改行を処理します。1つ目は、デフォルトの方法でテキストを改行し、2つ目、3つ目は、テキストに強制的に、改行を作成して分割しないようにします。

      まず、nanoまたはお好みのエディターを使用して、main.cssという新しいファイルを作成して開きます。

      次のコンテンツを追加します。これはwhite-spaceを含むいくつかのプロパティを使用する3つのCSSクラスを導入します。

      ./main.css

      .sammy-wrap {
          border-radius: 6px;
          background-color: aliceblue;
          border: 2px dashed gray;
          max-width: 70%;
          padding: 1em;
          margin-bottom: .4em;
      }
      .sammy-nowrap-1 {
          border-radius: 6px;
          background-color: aliceblue;
          border: 2px dashed gray;
          max-width: 70%;
          padding: 1em;
          margin-bottom: .4em;
          white-space: nowrap;
      }
      .sammy-nowrap-2 {
          border-radius: 6px;
          background-color: aliceblue;
          border: 2px dashed gray;
          max-width: 70%;
          padding: 1em;
          margin-bottom: .4em;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
      }
      

      1つ目のクラスは.sammy-wrapです。これはborder-radiusbackground-colorborder max-widthpadding、およびmargin-bottomを含む6つの一般的なCSSプロパティを定義します。このクラスは、ビジュアルボックスを作成しますが、特別な折り返しプロパティを定義しません。これは、デフォルトの方法で改行することを意味します。

      2つ目のクラスは.sammy-nowrap-1です。.sammy-rapと同じボックスを定義しますが、ここでは別のプロパティであるwhite-spaceを追加します。white-spaceプロパティにはさまざまなオプションがあり、これらはすべて、指定された要素内の空白の処理方法を定義します。ここでは、white-spacenowrapに設定しました。これにより、すべての改行が防止されます。

      3つ目のクラスは.sammy-nowrap-2です。white-spaceに、overflowtext-overflowの2つの追加プロパティを加えます。overflowプロパティは、スクロール可能なオーバーフローを処理します。これは、要素内のコンテンツが要素の領域からはみ出している場合に行われます。overflowプロパティにより、そのコンテンツをスクロール可能、表示可能、または非表示にすることができます。overflowhiddenに設定し、text-overflowプロパティを使用して、さらにカスタマイズを加えています。text-overflowは、追加のテキストが非表示の状態であることをユーザーに通知するのに役立ちます。これをellipsisに設定したので、行が切り取られたり、ボックスを超えたりすることはありません。CSSは、オーバーフローを非表示にし、隠れたコンテンツを...で通知します。

      ファイルを保存して閉じます。

      これでスタイルシートができたので、サンプルテキストを含む簡単なHTMLファイルを作成する準備が整いました。次に、ブラウザに Webページをロードし、CSSがどのように改行を防ぐことができるかを調べます。

      ステップ 2 ーHTMLファイルの作成

      定義されたCSSクラスを使用して、いくつかのサンプルテキストに適用できます。

      お好みのエディターで、index.htmlというファイルを作成して開きます。必ずmain.cssと同じフォルダに配置してください。

      次のコンテンツを追加します。これにより、main.cssstylesheetと関連づけられ、サンプルテキストブロックにクラスが適用されます。

      ./index.html

      <!DOCTYPE HTML>
      <html>
      <head>
      <meta charset="UTF-8">
      <title>How To Prevent Line Breaks with CSS</title>
      <link href="https://www.digitalocean.com/community/tutorials/main.css" rel="stylesheet">
      </head>
      
      <body>
      <p class="sammy-wrap"    > Medusafish banded killifish convict blenny saury threadsail beluga sturgeon. Indian mul mora cisco masu salmon, roosterfish requiem shark longnose lancetfish bluefish red snapper Sacramento splittail giant danio.</p>
      
      <p class="sammy-nowrap-1"> Medusafish banded killifish convict blenny saury threadsail beluga sturgeon. Indian mul mora cisco masu salmon, roosterfish requiem shark longnose lancetfish bluefish red snapper Sacramento splittail giant danio.</p>
      
      <p class="sammy-nowrap-2"> Medusafish banded killifish convict blenny saury threadsail beluga sturgeon. Indian mul mora cisco masu salmon, roosterfish requiem shark longnose lancetfish bluefish red snapper Sacramento splittail giant danio.</p>
      
      <p class="sammy-wrap"    > Medusafish&nbsp;banded&nbsp;killifish&nbsp;convict&nbsp;blenny&nbsp;saury&nbsp;threadsail&nbsp;beluga&nbsp;sturgeon.&nbsp;Indian&nbsp;mul&nbsp;mora&nbsp;cisco&nbsp;masu&nbsp;salmon,&nbsp;roosterfish&nbsp;requiem&nbsp;shark&nbsp;longnose&nbsp;lancetfish&nbsp;bluefish&nbsp;red&nbsp;snapper&nbsp;Sacramento&nbsp;splittail&nbsp;giant&nbsp;danio.</p>
      </body>
      </html>
      

      1つ目のテキストブロックには標準の折り返しスタイルを割り当て、2つ目のブロックにはnowrapスタイル、3つ目のブロックにはnowraphiddenellipsisスタイルを付けて割り当てました。4つ目のサンプルにはsammy-wrapを割り当てましたが、改行なしスペース(&nbsp;)をHTMLに直接挿入することにより、デフォルトの折り返しを無効にしています。1度限りの状況で改行を防ぐ必要がある場合は、改行なしスペースを使用することですばやく解決できます。

      Webブラウザでindex.htmlを開き、結果を表示します。4つのテキストブロックは次のように表示されます。

      Medusafish banded killifish convict blenny saury threadsail beluga sturgeon. Indian mul mora cisco masu salmon, roosterfish requiem shark longnose lancetfish bluefish red snapper Sacramento splittail giant danio.

      Medusafish banded killifish convict blenny saury threadsail beluga sturgeon. Indian mul mora cisco masu salmon, roosterfish requiem shark longnose lancetfish bluefish red snapper Sacramento splittail giant danio.

      Medusafish banded killifish convict blenny saury threadsail beluga sturgeon. Indian mul mora cisco masu salmon, roosterfish requiem shark longnose lancetfish bluefish red snapper Sacramento splittail giant danio.

      Medusafish banded killifish convict blenny saury threadsail beluga sturgeon. Indian mul mora cisco masu salmon, roosterfish requiem shark longnose lancetfish bluefish red snapper Sacramento splittail giant danio.

      CSSプロパティを正常にカスタマイズして、4つの異なる方法で改行を防いだり、許可することができました。

      まとめ

      このチュートリアルでは、CSSを使用して、テキストブロックの改行を防ぎました。ボックス内にテキストのスタイルを設定し、white-spaceプロパティを追加して、デフォルトのテキストの折り返しを無効にしました。テキストの折り返しと空白の処理の詳細については、white-spaceのCSSプロパティ全体を調べることを検討してください。



      Source link

      ChromeでPure CSSを使用して視差スクロール効果を作成する方法


      はじめに

      最新のCSSは、多くの高度なユーザーインターフェース(UI)機能を作成するために使用できる強力なツールです。以前は、これらの機能はJavaScriptライブラリに依存していました。

      このガイドでは、Webページにスクロール視差効果を作成するために、いくつかのCSS行を設定します。placekitten.comの画像をプレースホルダーの背景画像として使用します。

      チュートリアルを完了すると、Pure CSSのスクロール視差効果が適用されたWebページが作成されます。

      警告:この記事では、ブラウザ間で機能しない試験的なCSSプロパティを使用します。このプロジェクトはテスト済みで、Chromeで動作します。Firefox、Safari、iOSでは、ブラウザの最適化のため、この手法はうまく機能しません。

      ステップ 1 — 新しいプロジェクトの作成

      このステップでは、コマンドラインを使用して、新しいプロジェクトフォルダとファイルを設定します。開始するには、端末を開き、新しいプロジェクトフォルダを作成します。

      次のコマンドを入力して、プロジェクトフォルダを作成します。

      この場合、フォルダにcss-parallaxと名前を付けました。ここで、css-parallaxフォルダに移動します。

      次に、nanoコマンドを使用して、css-parallaxフォルダにindex.htmlファイルを作成します。

      プロジェクトのすべてのHTMLをこのファイルに入れます。

      次のステップでは、Webページの構造の作成を開始します。

      ステップ 2 —アプリケーション構造の設定

      このステップでは、プロジェクトの構造を作成するために必要なHTMLを追加します。

      index.htmlファイル内に次のコードを追加します。

      css-parallax/index.html

      
      <!DOCTYPE html>
      <html lang="en">
        <head>
          <meta charset="UTF-8" />
          <meta name="viewport" content="width=device-width, initial-scale=1.0" />
          <title>CSS Scrolling Parallax</title>
        </head>
        <body></body>
      </html>
      

      これは、HTMLを使用する多くのWebページの基本的な構造です。

      <body>タグ内に次のコードを追加します。

      css-parallax/index.html

      
      <body>
      ...
         <main>
            <section class="section parallax bg1">
               <h1>Cute Kitten</h1>
            </section>
            <section class="section static">
               <h1>Boring</h1>
            </section>
            <section class="section parallax bg2">
               <h1>Fluffy Kitten</h1>
            </section>
         </main>
      ...
      </body>
      
      

      このコードは3つの異なるセクションを作成します。2つには背景画像があり、1つは静的で無地の背景になります。

      次に示すいくつかのステップでは、HTMLに追加したクラスを使用して、各セクションのスタイルを追加します。

      ステップ 3 — CSSファイルの作成と初期CSSの追加

      このステップでは、CSSファイルを作成します。次に、Webサイトのスタイルを設定し、視差効果を作成するために必要な初期CSSを追加します。

      まず、nanoコマンドを使用して、css-parallaxフォルダにstyles.cssファイルを作成します。

      ここに、視差スクロール効果を作成するために必要なすべてのCSSを配置します。

      次に、.wrapperクラスから始めます。styles.cssファイル内に次のコードを追加します。

      css-parallax/styles.css

      .wrapper {
        height: 100vh;
        overflow-x: hidden;
        overflow-y: auto;
        perspective: 2px;
      }
      

      .wrapperクラスは、ページ全体の見え方とスクロールのプロパティを設定します。

      視差スクロール効果を機能させるには、wrapperの高さを固定値に設定する必要があります。ビューポートの単位vh100に設定すると、画面のビューポートの最大高さを取得できます。

      画像を拡大縮小すると、画面に水平スクロールバーが追加されるため、overflow-x: hidden;を追加して、このスクロールバーを無効にすることができます。perspectiveプロパティは、ビューポートから、CSSで作成してさらに下方向に変換する擬似要素までの距離をシミュレートします。

      次のステップでは、CSSをさらに追加してWebページのスタイルを設定します。

      ステップ 4 —.sectionクラスにスタイルを追加する

      このステップでは、.sectionクラスにスタイルを追加します。

      styles.cssファイル内で、 wrapperクラスの下に次のコードを追加します。

      css-parallax/styles.css

      
      .wrapper {
        height: 100vh;
        overflow-x: hidden;
        perspective: 2px;
      }
      .section { 
        position: relative;
        height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        text-shadow: 0 0 5px #000;
      }
      

      .sectionクラスは、メインセクションのサイズ、表示、テキストプロパティを定義します。

      positionをrelativeに設定して、子の.parallax::afterが親要素の.sectionに対して、確実に相対的に配置されるようにします。

      各セクションは、ビューポートの最大高さを取得するために、view-height(vh)100に設定されています。この値は、セクションごとに任意の高さに変更および設定できます。

      最後に、残りのCSSプロパティを使用して、各セクション内のテキストをフォーマットし、スタイルを追加します。各セクションの中央にテキストを配置し、whiteの色を追加します。

      次に、疑似要素を追加してスタイルを設定し、HTML内の2つのセクションに視差効果を作成します。

      ステップ 5 —.parallaxクラスにスタイルを追加する

      このステップでは、.parallaxクラスにスタイルを追加します。

      まず、スタイルを設定する.parallaxクラスに、疑似要素を追加します。

      注:CSSの疑似要素の詳細については、MDN Webドキュメントをご覧ください。

      .sectionクラスの下に次のコードを追加します。

      css-parallax/styles.css

      ...
      
      .section {
        position: relative;
        height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        text-shadow: 0 0 5px #000;
      }
      
      .parallax::after {
        content: " ";
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        transform: translateZ(-1px) scale(1.5);
        background-size: 100%;
        z-index: -1;
      }
      ...
      

      .parallaxクラスは、背景画像に::afterの疑似要素を追加し、視差効果に必要な変換を指定します。

      疑似要素は、.parallax.クラスの最後の子要素です。

      コードの前半は、疑似要素を表示して配置します。このtransformプロパティは、疑似要素をz-インデックス上のカメラから遠ざけるように移動し、その後ビューポートに広がるように元のサイズに戻します。

      疑似要素は遠くにあるため、動きが遅くなっているように見えます。

      次のステップでは、背景画像と静的背景スタイルを追加します。

      ステップ 6 — 各セクションに画像と背景を追加する

      このステップでは、静的セクションに背景画像と背景色を追加するために、最終的なCSSプロパティを追加します。

      まず、.parallax::afterクラスの後に、次のコードを使用して.staticセクションに無地の背景色を追加します。

      css-parallax/styles.css

      ...
      
      .parallax::after {
        content: " ";
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        transform: translateZ(-1px) scale(1.5);
        background-size: 100%;
        z-index: -1;
      }
      
      .static {
        background: red;
      }
      ...
      

      この.staticクラスは、画像のない静的セクションに背景を追加します。

      .parallaxクラスの2つのセクションには、それぞれ異なる追加のクラスもあります。.bg1.bg2クラスを使用して、子猫の背景画像を追加します。

      .staticクラスに次のコードを追加します。

      css-parallax/styles.css

      ...
      
      .static {
        background: red;
      }
      .bg1::after {
        background-image: url('https://placekitten.com/g/900/700');
      }
      
      .bg2::after {
        background-image: url('https://placekitten.com/g/800/600');
      }
      
      ...
      

      .bg1、.bg2クラスは各セクションにそれぞれの背景画像を追加します。

      これらの画像は、placekittenWebサイトに掲載されているものです。これは、プレースホルダーとして使用する子猫の写真を取得するためのサービスです。

      視差スクロール効果のすべてのコードが追加されたので、index.html内のstyles.cssファイルにリンクできます。

      ステップ 7 — styles.cssをリンクして、ブラウザでindex.htmlを開く

      このステップでは、styles.cssファイルをリンクし、ブラウザでプロジェクトを開いて、視差スクロール効果を確認します。

      まず、index.htmlファイル内の<head>タグに次のコードを追加します。

      css-parallax/index.html

       ...
      <head>
        <meta charset="UTF-8" />
        <^>
        <link rel="stylesheet" href="https://www.digitalocean.com/community/tutorials/styles.css" />
        <^>
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>CSS Parallax</title>
      </head>
      
      ...
      

      これで、ブラウザでindex.htmlファイルを開くことができます。

      スクロール視差効果GIF

      これにより、スクロール効果のある機能的なWebページを設定できました。このGitHubリポジトリを見て、完全なコードを確認してください。

      まとめ

      この記事では、index.htmlstyles.cssファイルを使用してプロジェクトを設定し、機能的なWebページを作成しました。Webページの構造を追加し、サイトのさまざまなセクションのスタイルを作成しました。

      使用する画像や視差効果を遠くに配置して、動きを遅くすることができます。perspectivetransformプロパティでピクセル数を変更する必要があります。背景画像をまったくスクロールさせたくない場合は、perspective/translate/scaleの代わりに、background-attachment: fixed;を使用します。



      Source link

      How To Install and Use SQLite on Ubuntu 20.04


      How To Install and Use SQLite on Ubuntu 20.04

      The author selected the Free and Open Source Fund to receive a donation as part of the Write for DOnations program.

      Introduction

      SQLite is a free, cross-platform database management system. It is popular for its efficiency and ability to interface with many different programming languages.

      In this tutorial you will install SQLite on Ubuntu 20.04. You will then create a database, read data from it, insert items, delete items, and join items from separate tables.

      Note: This tutorial includes practical instructions for installing and using SQLite. It does not cover larger conceptual issues and production concerns, such as when one should, or should not, consider using a SQLite database. For an excellent overview of popular relational databases and how they compare, check out our article, SQLite vs MySQL vs PostgreSQL: A Comparison Of Relational Database Management Systems.

      Additionally, many languages maintain integrations with SQLite. For instructions on using SQLite inside your Python code, check out our tutorial, How To Use the sqlite3 Module in Python 3.

      Prerequisites

      To complete this tutorial, you will need:

      Step 1 — Installing SQLite on Ubuntu 20.04

      To install the SQLite command-line interface on Ubuntu, first update your package list:

      Now install SQLite:

      • sudo apt-get install sqlite3

      To verify the installation, check the software’s version:

      You will receive an output like this:

      Output

      3.31.1 2020-01-27 19:55:54 3bfa9cc97da10598521b342961df8f5f68c7388fa117345eeb516eaa837balt1

      With SQLite installed, you are now ready to create a new database.

      Step 2 — Creating a SQLite Database

      In this step you will create a database containing different sharks and their attributes. To create the database, open your terminal and run this sqlite3 command:

      sqlite3 sharks.db
      

      This will create a new database named sharks. If the file sharks.db already exists, SQLite will open a connection to it; if it does not exist, SQLite will create it.

      You will receive an output like this:

      SQLite version 3.31.1 2020-01-27 19:55:54
      Enter ".help" for usage hints.
      

      Following this, your prompt will change. A new prefix, sqlite>, now appears:

      With your Shark database created, you will now create a new table and populate it with data.

      Step 3 — Creating a SQLite Table

      SQLite databases are organized into tables. Tables store information. To better visualize a table, one can imagine rows and columns.

      The rest of this tutorial will follow a common convention for entering SQLite commands. SQLite commands are uppercase and user information is lowercase. Lines must end with a semi-colon.

      Now let’s create a table and some columns for various data:

      • An ID
      • The shark’s name
      • The shark’s type
      • The shark’s average length (in centimeters)

      Use the following command to create the table:

      • CREATE TABLE sharks(id integer NOT NULL, name text NOT NULL, sharktype text NOT NULL, length integer NOT NULL);

      Using NOT NULL makes that field required. We will discuss NOT NULL in greater detail in the next section.

      After creating the table, an empty prompt will return. Now let’s insert some values into it.

      Inserting Values into Tables

      In SQLite, the command for inserting values into a table follows this general form:

      INSERT INTO tablename VALUES(values go here);

      Where tablename is the name of your table, and values are within parentheses.

      Now insert three rows of VALUES into your sharks table:

      • INSERT INTO sharks VALUES (1, "Sammy", "Greenland Shark", 427);
      • INSERT INTO sharks VALUES (2, "Alyoshka", "Great White Shark", 600);
      • INSERT INTO sharks VALUES (3, "Himari", "Megaladon", 1800);

      Because you earlier specified NOT NULL for each of the variables in your table, you must enter a value for each.

      For example, try adding another shark without setting its length:

      • INSERT INTO sharks VALUES (4, "Faiza", "Hammerhead Shark");

      You will receive this error:

      Output

      Error: table sharks has 4 columns but 3 values were supplied

      In this step you created a table and inserted values into it. In the next step you will read from your database table.

      Step 4 — Reading Tables in SQLite

      In this step, we will focus on the most basic methods of reading data from a table. Recognize that SQLite provides more specific methods for viewing data in tables.

      To view your table with all of the inserted values, use SELECT:

      You will see the previously inserted entries:

      Output

      1|Sammy|Greenland Shark|427 2|Alyoshka|Great White Shark|600 3|Himari|Megaladon|1800

      To view an entry based on its id (The values we set manually), add the WHERE command to your query:

      • SELECT * FROM sharks WHERE id IS 1;

      This will return the shark whose id equals 1:

      Output

      1|Sammy|Greenland Shark|427

      Let’s take a closer look at this command.

      1. First, we SELECT all (*) values from our database, sharks.
      2. Then we look at all id values.
      3. Then we return all table entries where id is equal to 1.

      So far you have created a table, inserted data into it, and queried that saved data. Now you will update the existing table.

      Step 5 — Updating Tables in SQLite

      In the following two sections you will first add a new column into your existing table and then update existing values in the table.

      Adding Columns to SQLite Tables

      SQLite allows you to change your table using the ALTER TABLE command. This means that you can create new rows and columns, or modify existing rows and columns.

      Use ALTER TABLE to create a new column. This new column will track each shark’s age in years:

      • ALTER TABLE sharks ADD COLUMN age integer;

      You now have a fifth column, age.

      Updating Values in SQLite Tables

      Using the UPDATE command, add new age values for each of your sharks:

      • UPDATE sharks SET age = 272 WHERE id=1;
      • UPDATE sharks SET age = 70 WHERE id=2;
      • UPDATE sharks SET age = 40 WHERE id=3;

      Output

      1|Sammy|Greenland Shark|427|272 2|Alyoshka|Great White Shark|600|70 3|Himari|Megaladon|1800|40

      In this step you altered your table’s composition and then updated values inside the table. In the next step you will delete information from a table.

      Step 6 — Deleting Information in SQLite

      In this step you will delete entries in your table based on the evaluation of an argument.

      In the following command you are querying your database and requesting that that it delete all sharks in your sharks table whose age is less than 200:

      • DELETE FROM sharks WHERE age <= 200;

      Typing SELECT * FROM sharks; will verify that Alyoshka and Himari, who were each less than 200 years old, were deleted. Only Sammy the Greenland Shark remains:

      Output

      1|Sammy|Greenland Shark|427|272

      Step 7 — Joining Information in SQLite

      Let’s imagine that we had two tables: our current sharks table and an endangered table. Now what if the endangered table had an id value that mapped to the ids in your sharks table, and it also had a status value that indicated each shark’s conservation status?

      If you wanted to query data from both tables, you could use one of SQLite’s four join commands:

      • INNER JOIN
      • OUTER JOIN
      • LEFT JOIN
      • CROSS JOIN

      Let’s create that second table and then use INNER JOIN to join some data.

      First, create your endangered table:

      • CREATE TABLE endangered (id integer NOT NULL, status text NOT NULL);
      • INSERT INTO endangered VALUES (1, "near threatened");

      Now join your tables:

      SELECT * FROM sharks INNER JOIN endangered on sharks.id = endangered.id;

      Your output will look like this:

      Output

      1|Sammy|Greenland Shark|427|272|1|near threatened

      Note that the output also includes the id value from endangered. You can specify desired output with a more explicit command:

      • SELECT sharks.id, sharks.name, sharks.sharktype, sharks.length, sharks.age, endangered.status FROM sharks INNER JOIN endangered on sharks.id = endangered.id;

      This time the output excludes the second id value:

      Output

      1|Sammy|Greenland Shark|427|272|near threatened

      You have now successfully joined information from multiple tables.

      Conclusion

      SQLite is a useful tool for database management. One can quickly create a database and manipulate it with various commands. Following this tutorial, you now have a basic understanding of SQLite and you are prepared dive deeper into this database management system.

      For an excellent overview of Relational Databases systems and how they compare, check out our article, SQLite vs MySQL vs PostgreSQL: A Comparison Of Relational Database Management Systems.

      Additionally, many languages maintain integrations with SQLite. For instructions on using SQLite inside your Python code, check out our tutorial, How To Use the sqlite3 Module in Python 3.

      For specific help with SQLite’s syntax, the official documentation is another excellent resource.



      Source link