Back to articles
SELECT QUERIES FROM A SPECIFIC DATABASE

SELECT QUERIES FROM A SPECIFIC DATABASE

via Dev.to BeginnersChristina Sharon S

The SELECT statement is one of the most fundamental SQL commands and is used to retrieve data from a PostgreSQL database. Syntax: SELECT column_name FROM table_name ; I was given a few tasks to strengthen my sql basics so this blog will contain the queries that i performed after connecting my dvdrental database to PostgreSQL. 1.Retrieve film titles and their rental rates. Use column aliases to rename title as "Movie Title" and rental_rate as "Rate". SELECT title AS "Movie_title" , rental_rate AS "Rate" FROM film ; 2.List customer names and their email addresses. Alias first_name and last_name as "First Name" and "Last Name". SELECT first_name AS "First Name" , last_name AS "Last Name" , email FROM customer ; 3.Get a list of films sorted by rental rate in descending order. If two films have the same rental rate, sort them alphabetically by title. SELECT title , rental_rate FROM film ORDER BY rental_rate DESC , title ASC ; 4.Retrieve actor names sorted by last name, then first name. SELE

Continue reading on Dev.to Beginners

Opens in a new tab

Read Full Article
5 views

Related Articles