What is the difference between them? Which of them is used in building websites and which of them is used in designing application for mobile phones and other systems?
J2EE is the "Enterprise Edition" which adds a framework for server-side web apps. I don't remember if JDBC (the database interface code) is part of J2EE or a separate package. But it's for making online stores and other useful nonsense that usually use a database server for "persistence" of objects. See this: http://download.oracle.com/javaee/6/api/
There are several versions of java:
standard edition (SE): the "core" java if you will
enterprise edition (EE): things like web apps and lots of enterprisy goodies
mobile edition (ME): for mobile devices
If you want to learn java you will have to start with standard edition (likely what you refer to as "core" java) as this will provide you with the basics of the language.