Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
If I am not wrong, this is the best practice because of the following reasons:
Maybe for this particular case, using '*' after the keyword 'SELECT' could lead to the same result, but I think it is good to develop the habit of just fetching the required columns by using their names and thus avoiding the possible fetching of unnecessary or sensible data.
Not the Best Practices definatly
This solution only fits on a single line but forces the array to be traversed twice.
This seems quciker then what i wrote lol
In theory, yes. Bust in many cases the time saved by using a wildcard is more important. Plus, you can limit your sample to, let's say, 100 rows and not worry about how many columns you have there anymore.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Use what your language offers you. Codewars uses PostgreSQL and I will use LIMIT if PostgreSQL allows me. It is infinitely more readable than your solution.
right? i test it too. it not work with last test
This comment is hidden because it contains spoiler information about the solution
Doesn't work for:
$this->assertEquals([], solution(""));
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This does not check if the array is a valid matrix
Not best practice because this mutates the original array.
Loading more items...