A lawyer is an individual, usually specially trained for the task, who advises clients in legal matters and represents them publicly in courts of law relative to legal causes of action. Most countries today require professional law advisors in their juridical system. Lawyers have many names in different countries, including attorney, barrister, solicitor and advocate--many of these names indicate specific classes or ranks of lawyers.
Increasingly (where?), lawyers have taken over functions that used to be (and in some countries, still are) performed by other professionals, such as the notary public.
Professional advisors on legal matters first appeared... please fill out
Lawyers in the US
In the United States, most jurisdictions not only require that a lawyer have the degrees of LLB (bachelor of laws) and JD (Juris Doctorate) but also that the lawyer has taken and passed the relevant Bar Exam and been admitted to The Bar of the state in which he desires to practice, before he is permitted to practice before the courts of the state.
A graduate of a recognized university who holds the degree of JD may hold himself out the public as a lawyer and may style himself e.g. "Joe Smith, Esq." but may not engage in the business of advising multiple clients or representing them in court for pay without licensing for this purpose by the affected jurisdiction.
Some states have reciprocal agreements with each other that a lawyer admitted to the bar of one state may practice in the other. Other states require that, in order to practice before their courts, a lawyer must have either passed the relevant state bar exam and been admitted to practice, or must (as an admittee of another state) have formally associated himself with a local admittee, who is present any time the visitng lawyer appears in local courts. Each state has its own constitution and its own statutes, sometimes quite dissimilar form other states'. Unfamiliarity with the constitution, statutes and precedent of a given state would render a lawyer incompetent to properly represent clients before the courts of that state.
Paradoxically, some jurisdictions will allow a non-lawyer to sit as a judge, especially in lower courts, even though a non-lawyer may not practice before these same courts.
Some states have recognized and admitted to the practice of law any person who can pass the Bar Exam, regardless of education. Some jurisdictions allow any individual to represent themselves or to represent another "in Proper Person," with the express permission of the court, for no pay, and only for the case in question. That is, the individual appearing in proper person must not in any case or at any time be a lawyer for hire without a license.
Lawyers in the UK
In Great Britain, Australia, and several other common law countries, there are generally two kinds of lawyers - solicitors and barristers. Solicitors may practice before lower courts, but their main (and traditionally only) work is in legal work that other than court appearances, such as legal advice, conveyancing, wills. Barristers may practice before lower, superior and high courts. Traditionally (and still for major cases) both a solicitor (for advice) and a barrister (for representation) were required for court appearences.