avatarChristianlauer

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

1649

Abstract

Both, primary and foreign keys are utilized for providing data integrity. A primary key value is individual for each row and is not <code>NULL</code>. Each foreign key value in a row must be present in the primary key column of the primary key table, or be <code>NULL</code>[2].</p><figure id="b0bd"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/0*RRh8VDva8wizell6.png"><figcaption>Primary and Foreign Keys — Image Source: <a href="https://www.google.com/url?sa=i&amp;url=https%3A%2F%2Fwww.scaler.com%2Ftopics%2Fsql%2Fforeign-key-in-sql%2F&amp;psig=AOvVaw3clR2GUMrb3e3Z846GXwHC&amp;ust=1677224275240000&amp;cd=vfe&amp;ved=0CBEQjhxqFwoTCKj027uRq_0CFQAAAAAdAAAAABAE">Scaler</a>[3]</figcaption></figure><p id="4d8b">Furthermore, after the creation with the <code>CREATE TABLE</code> statement, you are able to provide existing tables with the <code>ALTER TABLE ADD PRIMARY KEY</code> statement, or the <code>ALTER TABLE ADD CONSTRAINT</code> statement with a fitting key, if needed.</p><p id="5343">Like other SaaS Data Warehouse providers, Google is thus taking the path of combining SQL and NoSQL features in a hybrid system. Typical classic Stern and Snowflake architectures can now be built or taken over from the source system. For other recent and interesting updates, click below:</p><div id="d1e9" class="link-block"> <a href="https://readmedium.com/google-launches-java-and-scala-procedures-for-bigquery-efbebc558b55"> <div> <div> <h2>Google launches Java and Scala Procedures for BigQuery</h2> <div><h3>Using stored procedures for Apache Spark with Java or

Options

Scala</h3></div> <div><p>medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*FveLPqXyY8S7oSCgaM9VxQ.jpeg)"></div> </div> </div> </a> </div><div id="26e3" class="link-block"> <a href="https://readmedium.com/3-new-features-in-big-query-that-will-make-data-engineers-happy-14d9c25697c7"> <div> <div> <h2>3 new Features in Big Query that will make Data Engineers happy</h2> <div><h3>Information Schema now in GA, more Fail Safe Information and BigLake Metastore</h3></div> <div><p>medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*MM9CjmsN2LjdPRYO9W2OQg.jpeg)"></div> </div> </div> </a> </div><h2 id="2f20">Sources and Further Readings</h2><p id="ff54">[1] Google, <a href="https://cloud.google.com/bigquery/docs/release-notes">Big Query release notes</a> (2023)</p><p id="87f3">[2] Google, <a href="https://cloud.google.com/bigquery/docs/information-schema-table-constraints">TABLE_CONSTRAINTS view</a> (2023)</p><p id="440b">[3] Scaler, <a href="https://www.google.com/url?sa=i&amp;url=https%3A%2F%2Fwww.scaler.com%2Ftopics%2Fsql%2Fforeign-key-in-sql%2F&amp;psig=AOvVaw3clR2GUMrb3e3Z846GXwHC&amp;ust=1677224275240000&amp;cd=vfe&amp;ved=0CBEQjhxqFwoTCKj027uRq_0CFQAAAAAdAAAAABAE">Foreign Key in SQL — Scaler Topics</a> (2023)</p></article></body>

Google made Primary and Foreign Keys for BigQuery generally available

Using Primary and Foreign Key Table Constraints in BigQuery SQL

Photo by Pert Wardhon on Unsplash

Already since February this year, Google launched the possibility to use primary and foreign keys when creating tables in preview mode. Now, they made it generally available, which means you can use it in a productive environment. In addition to this, you can now also manage constraints through the BigQuery API and view constraints in the BigQuery console in preview, according to a statement from Google[1].

Both, primary and foreign keys are utilized for providing data integrity. A primary key value is individual for each row and is not NULL. Each foreign key value in a row must be present in the primary key column of the primary key table, or be NULL[2].

Primary and Foreign Keys — Image Source: Scaler[3]

Furthermore, after the creation with the CREATE TABLE statement, you are able to provide existing tables with the ALTER TABLE ADD PRIMARY KEY statement, or the ALTER TABLE ADD CONSTRAINT statement with a fitting key, if needed.

Like other SaaS Data Warehouse providers, Google is thus taking the path of combining SQL and NoSQL features in a hybrid system. Typical classic Stern and Snowflake architectures can now be built or taken over from the source system. For other recent and interesting updates, click below:

Sources and Further Readings

[1] Google, Big Query release notes (2023)

[2] Google, TABLE_CONSTRAINTS view (2023)

[3] Scaler, Foreign Key in SQL — Scaler Topics (2023)

Data Science
Google
Programming
Bigquery
Technology
Recommended from ReadMedium