If in Table “account”, a column “cust_id” consists of {1,2,2,3,3,5,6,7,8,8} then what will be the output on executing the following MySQL statement? SELECT DISTINICT (cust_id) FROM account;
Answers
The given MYSQL query gives the distinct customer ids, the output will be
Output:
No.of records: 7
1
2
3
5
6
7
8
Explanation:
Given query is:
SELECT DISTINCT (cust_id) FROM account;
The SELECT DISTINCT statement returns the different values from the records only once. No duplication!
The account is the table name and cust_id is the attribute column from which we are extracting the different values present. {1,2,2,3,3,5,6,7,8,8} are the values present in the column cust_id in order.
So, this query returns the distinct values from the values present in cust_id, i.e., {1,2,2,3,3,5,6,7,8,8} only once.
Therefore, the output will be 1, 2, 3, 5, 6, 7, 8, where the total of 10 records has been reduced to 7 in view, due to distinct operation.
Learn more:
1. Write SQL commands for the given data basis of FAMILY relation...
https://brainly.in/question/15115256
2. What are the maximum and the minimum number of rows returned by the R1 right outer join R2?
brainly.in/question/21195376