Now that we got data, which is hard coded, let's get the data from database. For this, we need two things. Number one, we need an RDBMS server. And number two, we need a data file. So first, let's go to a website called mokoro.com, which gives me mock data. So here I can choose what are the fields I want, what kind of data that I want for those fields.
And I can choose between CSV, JSON, SQL, etc. How many rows you want up to thousand, you can get it for free of cost. You can also choose what kind of line ending and so on and so forth. So in our customer, Java, we have ID as a number. So this is going to be okay roll number. I don't have a first name, last name, but I have just name so I can delete one of them.
And then call this as name. But the kind of data I don't want only last name, I want the full name so I can look for full name and that's going to be full name. I want Email, gender, I don't want an IP address, but I want a phone number. So I select the data type to be a phone. And that's going to be a phone number. You can also say what format of the phone number I just want 10 digit phone number nothing else.
I can also rearrange them add another field which is city. Let's add a city. One more state and one last for country. And then I can say here how many rows I want thousand days. okay with me. I want SQL format.
What is the name of the table? I'm going to call this as customers. Include CREATE TABLE also. And I can click on download data and I'll download the same thing into my workspace location which Under desktop, and my course folder, under workspace, I'm going to save it as customers.ms. SQL. Now that the file is ready, let's go and open the same thing in a text editor, which is here customers.ms SQL open with.
I'm going to open that with TextEdit. And this is how it looks like CREATE TABLE customers into ID notice that there is no primary key we can add them. And then say here, primary key, auto underscore increment. Name is supposed to be not null. Email, let's make it as unique. Same thing with phone is going to be unique.
And the rest of them are ok with me. I'll save this and close the file.