A composer could call any solo instrumental piece “sonata” if he or she wants to, but usually a sonata is quite a long piece with several movements. A sonatina is a simple and short sonata.
The term "sonata" was used in the 16th century to mean anything that was not sung.
In the Baroque period (17th and early 18th centuries) many composers like Arcangelo Corelli wrote sonatas with several movements. There were two types: “sonata da camera” (“room sonata” i.e. “chamber sonata”) which were for playing in people’s homes, and “sonata da chiesa” (“church sonata”) which were for being played in churches. The first type would have harpsichord accompaniment and the second type organ accompaniment. There would also be a cello playing the bass line. The solo instrument might be a violin, flute, recorder or oboe.
At the end of the Baroque period Domenico Scarlatti wrote over 500 sonatas for harpsichord. These are all short pieces in binary form (two sections).
By the time we come to the Classical period sonatas have become longer pieces with three or four movements. They would usually start with a fast movement, then a slow one, and then a fast one at the end. If there were four movements the extra one would be a minuet and trio or a scherzo, either before or after the slow movement. The first movement would be in sonata form. The most important composers of sonatas at this time were Haydn, Mozart and Beethoven