How do you assess programming related topics and avoid student cheating? I am teaching some programming topics to university students (some 300+) including python, sql etc. I would welcome some tips on what's the best way to assess the students and also avoid giving them the chance to copy each other.

So far the major piece of assignment, e.g., in SQL, is to give them a scenario describing an information system, explaining what are users, types of data, relations etc. And they are asked to use sql to implement a database, populate some data, and perform some queries.

The problem with this is that the correct solution is quite standard, so it is often the case that students submit same or very similar solutions. This itself may not be the problem, but combined with the factor that the large majority of the cohort gets very high grades (>70%), I fear that they are copying, but I cannot think of an easy way to find out, or address this.

Does anyone teach similar technical subjects and if so, how would you suggest to fix this?

Many thanks!
In general, it sounds like your problem is not to find out how to assess whether plagiarism occurred, but rather how to make tests that are harder to plagiarize. I will try to answer to both:

Plagiarism reduction can be achieved  building a database of questions to be leveraged to create "individualised" tests. To elaborate further, you could:


build a database with a number of questions larger than the one you intend to submit to students (as suggested in a previous answer)
build personalised tests by pulling questions randomly from the database above. 
randomise the input values of the questions (making up a trivial SQL example: "what is the n_th most likely value in m_th column of table k?" where n,m and k are randomly exctracted). 


Existing e-learning platforms (Moodle for example) contain all three features abobe, and allow you to collect the student responses in a centralised manner -
 so you don't need to reinvent the wheel.

Plagiarism detection becomes easier if you receive the test answers digitally. For humanities, text analytics would be needed, and I would recommend using off-the-shelf tools. For quantitative subjects, you can cluster students according to the submission time and score received in each test, and see whether some groups of students cluster too closely together (in small classes, no actual clustering algorithm is needed). This will not suffice to trigger punishment, but you can use it to focus on scrutinizing the student's thought process that led to the solution in a face-to-face exam.