To find a data line of work in 2023, you will have to learn SQL. Similarly, as with any language and particularly when you are a fledgling, it very well may be valuable to have a rundown of normal SQL orders and administrators in a single spot to allude to at whatever point you want it — we might want to be that spot for you!
The following is a complete rundown of SQL orders, coordinated by the high level of each (for example SELECT TOP is inside the SELECT class) in Top SQL Commands
In the event that you're on an excursion to learn SQL and you've been baffled by the absence of design or the dull educational plan made out of Google look, then, at that point, you might like Dataquest's intuitive SQL courses. Whether you're a novice attempting to prepare work or a carefully prepared engineer hoping to remain sharp, there's a SQL course for you.
SELECT is probably the most commonly-used SQL statement. You’ll use it pretty much every time you query data with SQL. It allows you to define what data you want your query to return.
For example, in the code below, we’re selecting a column called name from a table called customers.
SELECT name
FROM customers;
SELECT used with an asterisk (*) will return all of the columns in the table we’re querying.
SELECT * FROM customers;
SELECT DISTINCT only returns data that is distinct — in other words, if there are duplicate records, it will return only one copy of each.
The code below would return only rows with a unique name from the customer's table.
SELECT DISTINCT name
FROM customers;
SELECT INTO copies the specified data from one table into another.
SELECT * INTO customers
FROM customers_backup;
SELECT TOP only returns the top x number or percent from a table.
The code below would return the top 50 results from the customer's table:
SELECT TOP 50 * FROM customers;
The code below would return the top 50 percent of the customer's table:
SELECT TOP 50 PERCENT * FROM customers;
AS renames a column or table with an alias that we can choose. For example, in the code below, we’re renaming the name column as first_name:
SELECT name AS first_name
FROM customers;
FROM specifies the table we’re pulling our data from:
SELECT name
FROM customers;
WHERE filters your query to only return results that match a set condition. We can use this together with conditional operators like =, >, <, >=, <=, etc.
SELECT name
FROM customers
WHERE name = ‘Bob’;
AND combines two or more conditions in a single query. All of the conditions must be met for the result to be returned.
SELECT name
FROM customers
WHERE name = ‘Bob’ AND age = 55;
OR combines two or more conditions in a single query. Only one of the conditions must be met for a result to be returned.
SELECT name
FROM customers
WHERE name = ‘Bob’ OR age = 55;
BETWEEN filters your query to return only results that fit a specified range.
SELECT name
FROM customers
WHERE age BETWEEN 45 AND 55;
LIKE searches for a specified pattern in a column. In the example code below, any row with a name that included the character Bob would be returned.
SELECT name
FROM customers
WHERE name LIKE ‘%Bob%’;
Other operators for LIKE:
IN allows us to specify multiple values we want to select when using the WHERE command.
SELECT name
FROM customers
WHERE name IN (‘Bob’, ‘Fred’, ‘Harry’);
IS NULL will return only rows with a NULL value.
SELECT name
FROM customers
WHERE name IS NULL;
IS NOT NULL does the opposite — it will return only rows without a NULL value.
SELECT name
FROM customers
WHERE name IS NOT NULL;
CREATE can be used to set up a database, table, index, or view.
CREATE DATABASE creates a new database, assuming the user running the command has the correct admin rights.
CREATE DATABASE dataquestDB;
CREATE TABLE creates a new table inside a database. The terms int and varchar(255) in this example specify the datatypes of the columns we’re creating.
CREATE TABLE customers (
customer_id int,
name varchar(255),
age int
);
CREATE INDEX generates an index for a table. Indexes are used to retrieve data from a database faster.
CREATE INDEX idx_name
ON customers (name);
CREATE VIEW creates a virtual table based on the result set of an SQL statement. A view is like a regular table (and can be queried like one), but it is not saved as a permanent table in the database.
CREATE VIEW [Bob Customers] AS
SELECT name, age
FROM customers
WHERE name = ‘Bob’;
DROP statements can be used to delete entire databases, tables, or indexes.
It goes without saying that the DROP command should only be used where absolutely necessary.
DROP DATABASE deletes the entire database including all of its tables, indexes, etc as well as all the data within it.
Again, this is a command we want to be very, very careful about using!
DROP DATABASE dataquestDB;
DROP TABLE deletes a table as well as the data within it.
DROP TABLE customers;
DROP INDEX deletes an index within a database.
DROP INDEX idx_name;
The UPDATE statement is used to update data in a table. For example, the code below would update the age of any customer named Bob in the customer's table to 56.
UPDATE customers
SET age = 56
WHERE name = ‘Bob’;
DELETE can remove all rows from a table (using ), or can be used as part of a WHERE clause to delete rows that meet a specific condition.
DELETE FROM customers
WHERE name = ‘Bob’;
ALTER TABLE allows you to add or remove columns from a table. In the code snippets below, we’ll add and then remove a column for a surname. The text varchar(255) specifies the datatype of the column.
ALTER TABLE customers
ADD surname varchar(255);
ALTER TABLE customers
DROP COLUMN surname;
That's all. These all are the basic SQL Commands
Also, Read What is Figma Ui UX Design and Why Does it Matter?
Customer needs are constantly evolving. Marketers and advertisers keep looking for new ways to understand their customers. However, there are several security concerns related to cookies and how enterprises resort to data collection.
We all understand how irritating it is to be incapable to find the right words to describe something we want to search for online. Google Lens is changing how we search by allowing us to search using images instead of words. This new tool is still in its early stages, but it has the chance to revolutionize the way we search the internet. However, it can be unpleasant sometimes, so this article will tell you about some great things about Google Lens and, if you don't like it, how to Turn off Google Lens on your iPhone.
In today's fast-paced digital world, printers remain an essential tool for both personal and professional use. Among the top printer brands, HP stands out for its reliability and performance. However, even the best printers can face issues from time to time. When you encounter problems with your HP printer, it's crucial to have reliable support at your fingertips. 123comsetup Provides third-party HP printer support services that have gained popularity for their convenience and expertise.
BERLIN -- If you`re a little bored of the usual grey and black phones hanging around, then HTC has another option for you. Joining its gorgeous red hue, the HTC One and the One Mini are now available in a shiny new shade of blue. Looks good, right?
Amid declining demand, the country`s largest car-maker, Maruti Suzuki India (MSI) has enhanced its market share in the April-July period this fiscal to over 40 per cent in the passenger vehicle segment. While rival Hyundai Motor India Ltd (HMIL) man
Esteemhost is a reliable java web hosting service provider. Check Esteemhost’s java hosting plans and get cheap and best java hosting service at lowest price. Esteemhost offers highest quality servers which are very much stable. Call us on toll fre
A cryptocurrency wallet is a piece of software that digitally stores the private keys necessary to sign bitcoin transactions on distributed ledgers. They're an important part of the cryptocurrency ecosystem since they're the only means to prove ownership of digital assets and conduct transactions that transfer or change them. They're also referred to as "crypto wallets," and they work similarly to the keys to a blockchain car. The car will not start without those keys. Without them, it would be impossible to verify ownership of a digital asset, which could be anything from a bitcoin to a token representing some type of asset.
Quantitative Aptitude Questions and Answers contains concepts and test papers on many topics such as problem on trains, time and work, simple interest, compound interests, partnership, problem on ages, average, numbers, calendar, boats and streams, clock, height, and distance, percentage, pipes and cisterns, profit and loss, speed, time and distance, etc.
Cryptocurrency wallets are specialized software programs that interact with different blockchain networks. Blockchains are digital ledgers that record a crypto coin's full history, including all of its transactions.