w3resource
Run SQL Query

SQL Exercise: Number of countries participated in the EURO cup 2016

SQL soccer Database: Basic Exercise-2 with Solution

2. From the following table, write a SQL query to count the number of countries that participated in the 2016-EURO Cup.

Sample table: player_mast


Sample Solution:

SELECT COUNT(DISTINCT team_id) 
FROM player_mast;

Sample Output:

 count
-------
    24
(1 row)

Relational Algebra Expression:

Relational Algebra Expression: Find the number of countries participated in the EURO cup 2016.

Relational Algebra Tree:

Relational Algebra Tree: Find the number of countries participated in the EURO cup 2016.

Practice Online



Sample Database: soccer

soccer database relationship structure

Query Visualization:

Duration:

Query visualization of Find the number countries participated in the EURO cup 2016 - Duration

Rows:

Query visualization of Find the number countries participated in the EURO cup 2016 - Rows

Cost:

Query visualization of Find the number countries participated in the EURO cup 2016 - Cost

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous SQL Exercise: Find the number of venues for EURO cup 2016.
Next SQL Exercise: Number of goals in EURO cup 2016 in normal schedule.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Share this Tutorial / Exercise on : Facebook and Twitter

SQL: Tips of the Day

Can a foreign key be NULL and/or duplicate?

First remember a Foreign key simply requires that the value in that field must exist first in a different table (the parent table). That is all an Foreign key is by definition. Null by definition is not a value. Null means that we do not yet know what the value is.

Ref: https://bit.ly/3uVu3OS