Meta’s Latest AI Release Is an Open Source Coding Bot

https://i.kinja-img.com/gawker-media/image/upload/c_fill,f_auto,fl_progressive,g_center,h_675,pg_1,q_80,w_1200/258717ed4da77db5a1c9b2cc88f42743.jpg

Right on cue, Meta has shared its latest AI drop with the world, and this time, the company is letting anybody get their hands on a bot that will write, debug, and describe code in a multitude of coding languages.

Why is Everyone Suing AI Companies? | Future Tech

As reports last week first hinted, Meta’s Code Llama is a full-on code-generating AI that uses natural language to create and describe code in multiple coding languages. Like most of the AI products Meta’s released as of late, the model is open source and is free to use both personally and commercially.

Meta tried to imply it wouldn’t completely replace programmers, instead calling it a tool to “make workflows faster” and “lower the barrier to entry for people who are learning to code.” The program can both create and debug code, it also can comprehend and provide text explanations for questions regarding different programming languages.

It supports languages including C++, Java, PHP, Typescript, Bash, and C#. There is also a specialized version of the model called Code Llama – Python, which is custom-designed for programming in what’s become one of the most commonplace coding languages.

There’s also The Code Llama – Instruct model which is better at comprehending natural language instructions. Meta said those looking to generate code should use the Instruct model since it’s “fine-tuned to generate helpful and safe answers in natural language.” That emphasis on safety is interesting, as previous coding bots have had mixed results creating workable code, and that’s not even mentioning researchers who have proved other bots like ChatGPT and Bard have been manipulated to create malicious code. Meta does have an acceptable use policy for its AI about generating malicious code, malware, or computer viruses.

As for the dangers of using the AI to produce harmful content, Meta said it red-teamed the program in an attempt to force it to produce malicious code and found “Code Llama answered with safer responses” compared to ChatGPT running on GPT-3.5 Turbo.

The model is based on the framework of Meta’s Llama 2 language model. The company said it further trained the LLM on “code-specific datasets.” According to Meta’s blog post, the model accepts both code and language prompts. Users are also able to tell the model more about its existing codebase, which should turn out more personalized responses.

Code Llama’s three different versions of the AI scaled with more parameters, with 7 billion, 13 billion, and 34 billion parameter versions available. Parameters are usually a marker for an AI’s overall capabilities of producing accurate results. The smaller the model, the more easily it can run on single GPUs. Meta also mentioned that the smaller models are faster and may be better for “real-time code completion.”

According to the blog post, the Code Llama 34B parameter version scored similarly to OpenAI’s GPT-3.5 on several tests like HumanEval that evaluate the capabilities of LLMs. The AI was far below what GPT-4 could do on HumanEval, but it did better than some other open source coding-centric models like Palm-Coder and StarCoder.

The model is akin to the Microsoft-owned GitHub Copilot and Amazon’s CodeWhisperer, though Copilot costs money after a 30-day trial and CodeWhisperer is only free for individual use. These kinds of models are reportedly popular among programmers, with Microsoft claiming that 92% of programmers at large companies are using AI to some extent.

It’s not all gravy. Meta is specifically stopping short of saying what’s in Llama 2’s training data, and for good reason. Some developers have already sued Microsoft and GitHub alleging the company trained the AI on their code, ignoring their licenses.

Gizmodo

Dark Forces: Remaster gives you a cleaned-up 4K view of an absolute classic

https://cdn.arstechnica.net/wp-content/uploads/2023/08/Screenshot-2023-08-23-at-2.12.41-PM-760×380.png

First-person view of a blaster mowing down Storm Troopers

Enlarge / A sideways grip on a rifle-style blaster is unlikely to provide higher accuracy, but it does, in fact, make you feel like a badass rebel.

Nightdive Studios/LucasArts

A wealth of first-person shooters from the period’s golden era have seen remasters lately. Now comes one of the true greats: Star Wars: Dark Forces Remaster.

Nightdive Studios, which has been showing everybody how to do justice to classic shooter upgrades recently with its remasters of Quake II and System Shock, is using that same KEX Engine to give just enough modernization, but not too much, to the LucasArts title that was even better than its Doom-but-it’s-Star-Wars promise.

In the notes and footage of its reveal trailer, Nightdive promises 4K/120 fps gameplay, modern gamepad support, trophies and achievements, remastered cutscenes, and, of course, blasting Storm Troopers that have markedly better aim on a monitor than they do on film. The remaster is “coming soon” to PS4/5, Xbox One/X/S, Nintendo Switch, and Steam on PC, with “a release date announcement later this year.”

My favorite video.

When LucasArts shut down in 2013, following Disney’s purchase of George Lucas’ empire, Lee Hutchinson offered his remembrance of Dark Forces:

Dark Forces was a fine shooter in its own right and looked amazing, but that Star Wars license rocketed its appeal right up into outer space. Dark Forces promised something irresistible to any geek: the ability to jump into the Star Wars universe and run around. Released in 1995, the game was LucasArts’ first foray into the nascent FPS genre. The company set the bar awfully high.

  • Here’s an original rendered cutscene in Dark Forces, and …


    Nightdive Studios/LucasArts

  • … here’s Nightdive’s remastered scene.


    Nightdive Studios/LucasArts

  • Late-game rocket-vs-plasma-cannon action.


    Nightdive Studios/LucasArts

  • Thank you for reading Ars Technica this far into the slideshow. Here is Lee Hutchinson’s little trooper, obtained by pre-ordering Dark Forces in 1995.


    Lee Hutchinson

As Hutchinson noted, and which fans likely remember, there were only hints of Jedi-dom in Dark Forces; you never got your hands on a lightsaber, and you never force-pushed anyone off a ledge. The later Jedi Knight games fixed that. Dark Forces also faced the same memory and texture-resolution challenges as other shooters of its time, but it had the advantage of its setting. Imperial ships and bases had always looked stark, drab, and oftentimes quite empty in the Star Wars films (also due to certain constraints). So when a TIE Fighter hangar challenges you with only a handful of goons in a sterile space that looks like it could hold 300, that’s not a flaw; that’s George Lucas’ budget-minded used-future aesthetic!

Larry Kuperman of Nightdive told IGN that the game should still feel like the original felt, and that means difficult. The title should be “popularly priced,” Kuperman said, which indicates something well below the typical AAA $60/$70 mark.

We’ll keep an eye out for the first signs of a release date on this one. And we’ll bide our time until Jedi Knight II: Jedi Outcast makes it into the industry’s remaster/revenue queue.

Ars Technica – All content

6 Best Online SQL Playgrounds to Test Your Queries

https://static1.makeuseofimages.com/wordpress/wp-content/uploads/2023/08/sql-written-on-syringe-like-shape.jpg

Setting up an environment to practice SQL can be challenging for beginners. Even experienced programmers may want to run queries without setting up a database.

MAKEUSEOF VIDEO OF THE DAYSCROLL TO CONTINUE WITH CONTENT

SQL online platforms are the best choice for this. It provides a development environment to run, manipulate, and test SQL queries. These free and interactive platforms provide development environments like that of a database. Here are the best online SQL playgrounds to run and test your SQL queries.

SQL Fiddle is one of the best choices for practicing SQL queries. It has a user-friendly interface that makes it easier to run SQL queries and commands. The interface has panels that separate the workspace and the output. It’s best for running short queries.

First, you must build a schema for the internal database by clicking the Build Schema button on the left panel. Then, write and run your queries on the right panel.

You will see the output at the bottom of the left panel. If there are errors in your code, SQL Fiddle notifies you to edit the code and rerun it.

You can also expand the screens to a preferred size and use the query terminators provided. At the bottom of the screen, you can view the structure of the database schema.

You can run queries for various SQL databases, including Oracle, PostgreSQL, MySQL, and SQLite. You can pick a database by selecting it from the drop-down menu on the navigation bar.

You can use DB Fiddle to test your SQL queries. The playground provides SQLite, MySQL, and PostgreSQL databases to work with.

The interface is simple and easy to use. They have sample queries to show you how to use their workspace. The panels separate the working environments and a navigation bar.

You can create your own schemas and SQL database tables. Then, run the queries with the click of a button. The panel at the bottom of the page displays your results.

You can collaborate with others on the platform in real-time. You can also change your code into Markdown format and fork code from other repositories.

DB Fiddle is free, but you can pay for the pro version to access advanced features like SQL assessments.

You can access the interface without having to sign-up. But you must create an account if you need to save your work. You can convert your workspace into private mode if you want to keep your work private.

DB Fiddle UK provides a simple and easy-to-use interface to run your queries. They support 10+ relational databases, including MySQL, PostgreSQL, and MariaDB. You are free to choose the version of the DB engine you want to work with.

You can quickly create a workspace by clicking the add batch button on the left of the page (with a plus sign on it). Then, you can run as many queries as you want. DB Fiddle UK allows hiding private data or leaving it public.

You can change your data into Markdown format on the interface. Also, you can highlight important parts of your code using their highlighting tool.

You don’t need to sign-up for the platform to interact with it; you can start working on it immediately.

SQLite Online provides a productive workspace for you to run SQL queries. You can work with three databases, namely MariaDB, PostgreSQL, and MySQL database engines. You can quickly write and run queries on the interface.

To work with a specific database, click on the database name provided on the left pane. SQLite Online will then open that workspace for you. If you have private data that you don’t wish to share with the public, you must sign up and save your work on the platform.

You can connect to your DB remotely and run queries in the workspace. You also have the option to connect to other online DBs.

SQLite Online allows you to import data sets to work with and equally export them as CSV, XML, JSON, or SQL schema format.

Paiza provides a dynamic playground to run and test MySQL queries. It supports over 20 programming languages, including PHP, Rust, Python, and Elixir. For beginners, this is a great platform to learn MySQL concepts.

Pick the language you want to run your queries, and the website will provide the workspace for it. The MySQL section provides a database engine to create tables, insert and select data.

You can use the workspace without signing up. But if you need a work record, register and create an account on the platform. You can import code from GitHub and run it on Paiza.

Also, you can collaborate on projects with your team on the platform. You can keep your workspace private or public for others to access. Paiza also provides a cloud platform to create and host your applications.

Programiz is a great platform to learn SQL interactively. The website provides everything you need to learn and practice SQL queries. As a beginner, you will learn from SQL basics to more advanced concepts while practicing on the interactive editor.

You don’t require prior knowledge; you can start learning from scratch. You can use the editor to create tables, insert new data, delete, and run other SQL operations.

Programiz tests your knowledge with sample data sets you can play with on the code editor. As a beginner, you can query the sample data code editor as you learn SQL.

The site has a comprehensive SQL course for which you can sign up and learn detailed SQL concepts. This site provides the guidance you need to begin your career as a database engineer.

How to Use Online SQL Playgrounds

Online SQL playgrounds are great platforms for learning and practicing SQL. These playgrounds might not fully replicate the complexity of real-world scenarios. But they give you an idea of how SQL works.

But you should be careful about the data you share on the platform. Don’t share any sensitive information that may be harmful if they get into the wrong hands. You should also set up a local instance and learn SQL concepts like string functions.

MakeUseOf

It’s happening tonight… ???? ???? ????

https://media.notthebee.com/articles/64e6854eac55564e6854eac556.jpg

I’m sure you will all be watching something else (cough cough), but if you happen to get overwhelmed with debate excitement, why not stop by X to check out Tucker’s totally-not-as-interesting interview with The Donald?

Not the Bee

5 SQL Constraints to Guarantee Good Database Structure

https://static1.makeuseofimages.com/wordpress/wp-content/uploads/2023/08/database-drives.jpg

Key Takeaways

  • Use SQL constraints to maintain data integrity and ensure uniformity in your database. The NOT NULL constraint forces columns to reject NULL values.
  • Implement primary key constraints to ensure uniqueness of values in a column or set of columns. This prevents duplicate records in a database table.
  • Foreign key constraints establish relationships between tables and prevent actions that would destroy links between them. They ensure that a record in the child table references the parent table.

A database is essential for many applications, but it can get messy if you don’t have guidelines for storing and processing data.

SQL constraints specify rules for storing data in a table. When you set constraints, the database will throw an error if you try to store data that violates these rules. Constraints help to maintain data integrity and ensure uniformity in your database.

There are several types of SQL constraints that you can use; here are some of the most useful.

1. NOT NULL Constraint

Database columns, by default, accept data with NULL values. NULL essentially means that no value exists. The NOT NULL constraint forces a column to reject NULL values.

This constraint ensures that each column must contain a value. You cannot add a record to the database without supplying data for any columns with the NOT NULL constraint.

Take the example of a Customers table. There are some necessary details about each customer that you want on record, like their name. Add the NOT NULL constraint to the mandatory fields to ensure that customers provide this information.

Here’s an example showing how you can use the NOT NULL constraint in a PostgreSQL database:

 CREATE TABLE Customers (
    ID int NOT NULL,
    LastName varchar(255) NOT NULL,
    FirstName varchar(255) NOT NULL,
    Mobile_No int NOT NULL,
    Age int
);

If you try inserting a customer record without the Age field, the database will accept it with no errors:

 INSERT INTO Customers (ID, LastName, FirstName, Mobile_No)
VALUES (123456, 'Dior', 'Christian', 0723000000);

However, if you try inserting a record without the FirstName field, the database will reject it with an error message:

 ERROR: null value in column "firstname" violates not-null constraint
Detail: Failing row contains (123456, Dior, null, 723000000, null).

2. PRIMARY KEY Constraint

A KEY is a unique attribute set to a column or field that identifies a table’s tuple (or a record) in database systems. A PRIMARY KEY constraint ensures the uniqueness of values in a column or set of columns. It acts as a unique identifier in a row, preventing duplicate records in a database table.

Primary keys contain unique values and cannot contain NULL values. Each SQL database table must have only one primary key. The PRIMARY KEY can have single or multiple columns.

For example, you are creating a database of customer records. You need each customer to enter their ID numbers differently from everybody else. You can apply the primary key constraint to ensure that none of your customers have the same ID number.

The following code shows how you can introduce a primary key constraint in a MySQL database:

 CREATE TABLE Customers (
    ID int NOT NULL,
    LastName varchar(255) NOT NULL,
    FirstName varchar(255),
    Age int,
   PRIMARY KEY (ID)
);

The database will not accept that value if a user enters another record with a similar ID. Instead, it will throw an error indicating duplication. The user tries to insert two records with the same ID in the following example:

 INSERT INTO Customers (ID, LastName, FirstName, Age)
VALUES (1, 'John', 'Doe', 35 );

INSERT INTO Customers (ID, LastName, FirstName, Age)
VALUES (1, 'Mary', 'Jane', 35 );

The database will show an error message:

 Duplicate entry '1' for key 'PRIMARY' 

But if you change the ID of the second customer, the database accepts the entry. Therefore, the primary key ensures no duplicate IDs in your customer records.

3. FOREIGN KEY Constraint

Foreign keys establish relationships between two tables. You can add a foreign key to a field/column in one table that references the primary key in another table.

The table with the primary key is the parent table, while the table with the foreign key is the child table. A record cannot then exist in the child table without a reference to the parent table.

The foreign key constraint prevents actions that would destroy links between tables. For example, you cannot DROP one table if it links to another with a foreign key. You will have to drop both tables at once.

Unlike a primary key, you can duplicate a foreign key and have more than one in a single table. Foreign key values can also be NULL. In the following example, you must use the customer_id to create an order.

 CREATE TABLE Customers (
    customer_id INT PRIMARY KEY,
    first_name VARCHAR(50),
    last_name VARCHAR(50)
);

CREATE TABLE Orders (
    order_id INT PRIMARY KEY,
    customer_id INT,
    order_date DATE,
    FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);

INSERT INTO Customers(customer_id, first_name, last_name)
VALUES (1, 'Christian', 'Dior');

INSERT INTO Orders(order_id, customer_id, order_date)
VALUES (1, 1, '2023-08-07');

If you try creating an order without an existing customer_id, the database shows an error message:

 Cannot add or update a child row: a foreign key constraint fails
(`db_9_4ee205c`.`orders`, CONSTRAINT `orders_ibfk_1` FOREIGN KEY
(`customer_id`) REFERENCES `customers` (`customer_id`))

4. UNIQUE Constraint

This constraint ensures that no two rows can have the same values for a specific column. Like primary keys, a unique constraint maintains data integrity and prevents duplicate entries. If you work with a poorly designed database without the UNIQUE constraint, you may end up having to find and delete the duplicates.

Unlike primary keys, you can have many UNIQUE constraints on one table. For example, when creating a Customers table, you may want to have unique IDs and phone numbers. To add such a constraint using MySQL server, use this syntax:

 CREATE TABLE Customers (
    ID int NOT NULL UNIQUE,
    LastName varchar(255) NOT NULL,
    FirstName varchar(255),
    Mobile_No BIGINT UNIQUE
);

If you insert records with the same mobile number in the database, it will then show an error message.

 INSERT INTO Customers (ID, LastName, FirstName, Mobile_No)
VALUES (123456, 'Dior', 'Christian', 254000000 );

INSERT INTO Customers (ID, LastName, FirstName, Mobile_No)
VALUES (7891011, 'Dedan', 'Kimathi', 254000000 );

The error message will be something like this:

 Duplicate entry '254000000' for key 'Mobile_No' 

This UNIQUE constraint ensures the database won’t have customers with the same IDs or mobile numbers.

5. CHECK Constraint

The CHECK constraint limits the value range put in a column. Adding a CHECK constraint on a column will allow only specified values for that column. It enforces data integrity by ensuring a user only inserts valid data in a table.

The CHECK constraint must evaluate a value as TRUE or UNKNOWN for each specified row or table entry. If the value is FALSE, the database shows an error message.

For example, in the Customers table, you may want only to serve customers over 18 years. You can add a CHECK constraint to ensure you don’t serve underage customers. You may add the constraint in a PostgreSQL database, as shown in the following code:

 CREATE TABLE Customers (
    ID int NOT NULL,
    Age int CHECK(Age>=18),
    LastName varchar(255) NOT NULL,
    FirstName varchar(255),
    Mobile_No BIGINT UNIQUE
);

Now if you try to insert a customer’s age below the age of 18:

 INSERT INTO Customers (ID, Age, LastName, FirstName, Mobile_No)
VALUES (123456, 15, 'Dior', 'Christian', 1254000000 );

The database will show an error message like this:

 ERROR: new row for relation "customers" violates check constraint
"customers_age_check"
Detail: Failing row contains (123456, 15, Dior, Christian, 1254000000)

How to Add and Remove SQL Constraints From Databases

SQL constraints are not cast in stone. You can add or remove constraints on existing tables using the ALTER TABLE statement. The ALTER statement allows you to work with constraints to suit your data needs.

There are many more SQL constraints you can learn to design a database to your liking. You can start with the ones listed in this article.

MakeUseOf

5 SQL Constraints to Guarantee Good Database Structure

https://static1.makeuseofimages.com/wordpress/wp-content/uploads/2023/08/database-drives.jpg

Key Takeaways

  • Use SQL constraints to maintain data integrity and ensure uniformity in your database. The NOT NULL constraint forces columns to reject NULL values.
  • Implement primary key constraints to ensure uniqueness of values in a column or set of columns. This prevents duplicate records in a database table.
  • Foreign key constraints establish relationships between tables and prevent actions that would destroy links between them. They ensure that a record in the child table references the parent table.

A database is essential for many applications, but it can get messy if you don’t have guidelines for storing and processing data.

SQL constraints specify rules for storing data in a table. When you set constraints, the database will throw an error if you try to store data that violates these rules. Constraints help to maintain data integrity and ensure uniformity in your database.

There are several types of SQL constraints that you can use; here are some of the most useful.

1. NOT NULL Constraint

Database columns, by default, accept data with NULL values. NULL essentially means that no value exists. The NOT NULL constraint forces a column to reject NULL values.

This constraint ensures that each column must contain a value. You cannot add a record to the database without supplying data for any columns with the NOT NULL constraint.

Take the example of a Customers table. There are some necessary details about each customer that you want on record, like their name. Add the NOT NULL constraint to the mandatory fields to ensure that customers provide this information.

Here’s an example showing how you can use the NOT NULL constraint in a PostgreSQL database:

 CREATE TABLE Customers (
    ID int NOT NULL,
    LastName varchar(255) NOT NULL,
    FirstName varchar(255) NOT NULL,
    Mobile_No int NOT NULL,
    Age int
);

If you try inserting a customer record without the Age field, the database will accept it with no errors:

 INSERT INTO Customers (ID, LastName, FirstName, Mobile_No)
VALUES (123456, 'Dior', 'Christian', 0723000000);

However, if you try inserting a record without the FirstName field, the database will reject it with an error message:

 ERROR: null value in column "firstname" violates not-null constraint
Detail: Failing row contains (123456, Dior, null, 723000000, null).

2. PRIMARY KEY Constraint

A KEY is a unique attribute set to a column or field that identifies a table’s tuple (or a record) in database systems. A PRIMARY KEY constraint ensures the uniqueness of values in a column or set of columns. It acts as a unique identifier in a row, preventing duplicate records in a database table.

Primary keys contain unique values and cannot contain NULL values. Each SQL database table must have only one primary key. The PRIMARY KEY can have single or multiple columns.

For example, you are creating a database of customer records. You need each customer to enter their ID numbers differently from everybody else. You can apply the primary key constraint to ensure that none of your customers have the same ID number.

The following code shows how you can introduce a primary key constraint in a MySQL database:

 CREATE TABLE Customers (
    ID int NOT NULL,
    LastName varchar(255) NOT NULL,
    FirstName varchar(255),
    Age int,
   PRIMARY KEY (ID)
);

The database will not accept that value if a user enters another record with a similar ID. Instead, it will throw an error indicating duplication. The user tries to insert two records with the same ID in the following example:

 INSERT INTO Customers (ID, LastName, FirstName, Age)
VALUES (1, 'John', 'Doe', 35 );

INSERT INTO Customers (ID, LastName, FirstName, Age)
VALUES (1, 'Mary', 'Jane', 35 );

The database will show an error message:

 Duplicate entry '1' for key 'PRIMARY' 

But if you change the ID of the second customer, the database accepts the entry. Therefore, the primary key ensures no duplicate IDs in your customer records.

3. FOREIGN KEY Constraint

Foreign keys establish relationships between two tables. You can add a foreign key to a field/column in one table that references the primary key in another table.

The table with the primary key is the parent table, while the table with the foreign key is the child table. A record cannot then exist in the child table without a reference to the parent table.

The foreign key constraint prevents actions that would destroy links between tables. For example, you cannot DROP one table if it links to another with a foreign key. You will have to drop both tables at once.

Unlike a primary key, you can duplicate a foreign key and have more than one in a single table. Foreign key values can also be NULL. In the following example, you must use the customer_id to create an order.

 CREATE TABLE Customers (
    customer_id INT PRIMARY KEY,
    first_name VARCHAR(50),
    last_name VARCHAR(50)
);

CREATE TABLE Orders (
    order_id INT PRIMARY KEY,
    customer_id INT,
    order_date DATE,
    FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);

INSERT INTO Customers(customer_id, first_name, last_name)
VALUES (1, 'Christian', 'Dior');

INSERT INTO Orders(order_id, customer_id, order_date)
VALUES (1, 1, '2023-08-07');

If you try creating an order without an existing customer_id, the database shows an error message:

 Cannot add or update a child row: a foreign key constraint fails
(`db_9_4ee205c`.`orders`, CONSTRAINT `orders_ibfk_1` FOREIGN KEY
(`customer_id`) REFERENCES `customers` (`customer_id`))

4. UNIQUE Constraint

This constraint ensures that no two rows can have the same values for a specific column. Like primary keys, a unique constraint maintains data integrity and prevents duplicate entries. If you work with a poorly designed database without the UNIQUE constraint, you may end up having to find and delete the duplicates.

Unlike primary keys, you can have many UNIQUE constraints on one table. For example, when creating a Customers table, you may want to have unique IDs and phone numbers. To add such a constraint using MySQL server, use this syntax:

 CREATE TABLE Customers (
    ID int NOT NULL UNIQUE,
    LastName varchar(255) NOT NULL,
    FirstName varchar(255),
    Mobile_No BIGINT UNIQUE
);

If you insert records with the same mobile number in the database, it will then show an error message.

 INSERT INTO Customers (ID, LastName, FirstName, Mobile_No)
VALUES (123456, 'Dior', 'Christian', 254000000 );

INSERT INTO Customers (ID, LastName, FirstName, Mobile_No)
VALUES (7891011, 'Dedan', 'Kimathi', 254000000 );

The error message will be something like this:

 Duplicate entry '254000000' for key 'Mobile_No' 

This UNIQUE constraint ensures the database won’t have customers with the same IDs or mobile numbers.

5. CHECK Constraint

The CHECK constraint limits the value range put in a column. Adding a CHECK constraint on a column will allow only specified values for that column. It enforces data integrity by ensuring a user only inserts valid data in a table.

The CHECK constraint must evaluate a value as TRUE or UNKNOWN for each specified row or table entry. If the value is FALSE, the database shows an error message.

For example, in the Customers table, you may want only to serve customers over 18 years. You can add a CHECK constraint to ensure you don’t serve underage customers. You may add the constraint in a PostgreSQL database, as shown in the following code:

 CREATE TABLE Customers (
    ID int NOT NULL,
    Age int CHECK(Age>=18),
    LastName varchar(255) NOT NULL,
    FirstName varchar(255),
    Mobile_No BIGINT UNIQUE
);

Now if you try to insert a customer’s age below the age of 18:

 INSERT INTO Customers (ID, Age, LastName, FirstName, Mobile_No)
VALUES (123456, 15, 'Dior', 'Christian', 1254000000 );

The database will show an error message like this:

 ERROR: new row for relation "customers" violates check constraint
"customers_age_check"
Detail: Failing row contains (123456, 15, Dior, Christian, 1254000000)

How to Add and Remove SQL Constraints From Databases

SQL constraints are not cast in stone. You can add or remove constraints on existing tables using the ALTER TABLE statement. The ALTER statement allows you to work with constraints to suit your data needs.

There are many more SQL constraints you can learn to design a database to your liking. You can start with the ones listed in this article.

MakeUseOf

How to Teach Your Kids to Code With a Raspberry Pi

https://static1.makeuseofimages.com/wordpress/wp-content/uploads/2022/09/how-to-boot-a-raspberry-pi-from-ssd-and-use-it-for-permanent-storage-1.jpeg

Teaching children to code at a young age helps them thrive in today’s technological world by developing skills in critical thinking, creativity, and problem-solving.

The Raspberry Pi, with its low price and ease of use, is a fantastic device for introducing young people to computing and programming. With applications in robotics, computer programming, and even home automation, it’s ideal for kids to learn to code.

1. Get Started With the Raspberry Pi

In an effort to make computers and digital creation accessible to everyone, the Raspberry Pi Foundation created the inexpensive and widely available Raspberry Pi computer. Several models and revisions have been made available since the first Raspberry Pi was introduced in 2012.

If you do not already have a Pi, you can get one for as little as $35. Be sure to get the flagship Raspberry Pi 4, although the older Raspberry Pi models have some merit. You can also purchase the Raspberry Pi 400, which offers much the same features as the Pi 4 and comes in a keyboard form factor.

The official Raspberry Pi 4 desktop kit costs more money but comes with most of the components you need to use the Raspberry Pi, including a keyboard, mouse, case, power supply, and microSD card. After that, all you will require is a compatible HDMI display that you can connect to the computer.

The microSD in the official kit comes preloaded with the Raspberry Pi OS, a Linux distribution created specially for Raspberry Pi computers. You can also follow our guide on how to install an operating system on a Raspberry Pi.

Your children can begin their coding journey as soon as the initial setup is complete. A good place to start is at the Raspberry Pi Foundation’s projects site.

2. Choosing a Kid-Friendly Programming Language

Code Club at a Library
Image Credit: Blue Mountains Library/Flickr

It is essential to choose a kid-friendly programming language in order to make programming enjoyable and interesting for your children. Scratch, Python, and Ruby are just a few of the most well-known choices.

Scratch

Scratch is an interactive programming environment that uses a block-based visual interface. It is one of the few languages designed to be used by children. Due to the visual programming style, Scratch is straightforward and intuitive to learn. Concepts introduced in Scratch can be applied to more advanced languages such as Python and Java.

The Scratch website has numerous tutorials dedicated to teaching you how to use the language. It is also possible to remix user-created projects on the website.

Aside from learning programming, Scratch can also serve as a springboard for your children to explore their artistic ideas in other areas of interest such as visual art and music.

Python

Python’s syntax is simple and intuitive for newcomers. The language is widely used: arguably, it’s the most popular programming language for the Raspberry Pi. For this reason, there are many resources available to help beginners get started.

It provides access to libraries of pre-written code that may be integrated into personal applications. This is a key benefit of Python as it makes it easier to interface with physical electronic components connected via the Raspberry Pi’s GPIO header and enables you to create advanced projects.

Ruby

Yukihiro “Matz” Matsumoto created Ruby in the 1990s in Japan. It’s a general-purpose language that’s been called “a programmer’s best friend” and has a lot in common with Python. It is also one of the easiest languages to begin programming with.

Like Python, Ruby’s syntax is both straightforward and expressive. It also does not rely on indentation to separate code blocks. It however places a greater emphasis on object-oriented programming than Python. It has waned in popularity over the years, but it is still an amazing language that is well-loved by developers and programmers.

Apart from the languages listed above, other excellent options for teaching your child coding include Lua, JavaScript, Swift, and Java (for older children).

3. Hands-On Projects and Challenges

elementary school child in robotics class
Image Credit: Arno Mikkor/Wikimedia Commons

To solidify their programming skills, it is important to encourage your kids to work on hands-on projects and challenges using the Raspberry Pi. Here are some ideas:

Create a Simple Game

A video game is a project that holds a lot of appeal for most children. There are several ways to make a gaming machine using your Raspberry Pi. You can start by creating a retro gaming console with a Raspberry Pi with no coding involved and then move on to the more engaging projects in our list of the best Raspberry Pi gaming projects.

Build an RC Car

This can be a good project if your child already has an RC car. It is possible to hotwire it so that it is controlled from the Raspberry Pi rather than the remote that came with it. The process is outlined in an Instructables guide that uses a Traxxas remote control car and a long-range Wi-Fi USB antenna.

If you would rather not go through the stressful but rewarding process of hacking an RC car, you can buy a Raspberry Pi RC car kit such as the PiCar-V from Sunfounder that already comes with programming functionality in the box.

Security Camera With Motion Detection

If your kid is interested in home security and surveillance technology, they can also find installing a motion-activated security camera to be an engaging pastime.

Using a Raspberry Pi and a Camera Module, kids can create a surveillance camera that records still images or video and can also detect motion. The Raspberry Pi can be programmed in Python to trigger a recording of every motion it detects and save the files to a USB drive or an online cloud storage service.

Our tutorial on how to create a multi-camera CCTV system with a Raspberry Pi and motionEyeOS is a great place to start.

4. Join Coding Communities and Clubs

Apart from choosing a programming language and working on projects, coding clubs allow your child to develop essential skills such as collaboration and communication faster.

You should encourage your children to join coding groups or other offline platforms that cater to young programmers in order to keep the momentum going and to build a sense of community. They can usually find collaborators and get advice from professionals in these settings. These groups also offer constant encouragement and help those new to coding develop their skills.

You can also try to look for a Code Club or CoderDojo near you. These organizations are supported by the Raspberry Pi Foundation, but they are not limited to Raspberry Pi hardware.

Help Your Kids Learn Coding Using a Raspberry Pi

The original intention of the Raspberry Pi was to make computers affordable and get more young people interested in coding. If your kids are eager to explore coding as a way to express their creativity and intuition, a Raspberry Pi can be a great investment to help them bring that vision to life.

With the aid of online resources, offline communities, and hands-on projects, the single-board computer can be a perfect tool for guiding your kids into the world of coding.

MakeUseOf