1. Other
  2. Other
  3. answer query psql u username d mydatabase c select ...

Question: answer query psql u username d mydatabase c select ...

Question details

Answer:

query

psql -U username -d mydatabase -c 'SELECT * FROM astronauts WHERE death > 1960 AND death < 1990'

 

Expected output

astroname

birth

death

age

Grissom, Gus

1626

1967

41

Eisele, Donn

1930

1987

57

White, Edward

1930

1967

37

Swigert, John

1931

1982

51

Chaffee, Roger

1935

1967

32

Answer

Here is the MySQL query for the above question:

SELECT projectname,missionno,craftname,launchyear FROM Table_name WHERE launchyear>1960 and projectname=“Mercury” ORDER BY missionno

TABLE_NAME IS NOT GIVEN IN THE INFORMATION GIVEN PLEASE REPLACE THE Table_name WITH ACTUAL TABLE NAME

Please add a ; afer the statement if you are running for ORACLE

Explanation:

SELECT is the keyword to fetch the rows we want from table

WHERE is used to apply the conditions we want

ORDER BY keyword is used to sort the row by a given column name and takes ASC or DESC as keywords so that we can sort them in our preferred order. By default it will take ASC what ever we needed in the question to be.

Question ;

Re-express the above natural join query as a cross product.

 

 

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution