How to Query data using SOQL

Salesforce Development Using Apex Apex and its Database language
1 hour 7 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$49.99
List Price:  $69.99
You save:  $20
€48.10
List Price:  €67.35
You save:  €19.24
£39.88
List Price:  £55.83
You save:  £15.95
CA$71.97
List Price:  CA$100.76
You save:  CA$28.79
A$80.16
List Price:  A$112.23
You save:  A$32.07
S$67.96
List Price:  S$95.14
You save:  S$27.18
HK$388.27
List Price:  HK$543.62
You save:  HK$155.34
CHF 45.02
List Price:  CHF 63.04
You save:  CHF 18.01
NOK kr569.59
List Price:  NOK kr797.48
You save:  NOK kr227.88
DKK kr358.90
List Price:  DKK kr502.49
You save:  DKK kr143.58
NZ$88.63
List Price:  NZ$124.10
You save:  NZ$35.46
د.إ183.61
List Price:  د.إ257.07
You save:  د.إ73.45
৳5,972.19
List Price:  ৳8,361.55
You save:  ৳2,389.35
₹4,258.89
List Price:  ₹5,962.79
You save:  ₹1,703.89
RM224.30
List Price:  RM314.04
You save:  RM89.74
₦77,378.02
List Price:  ₦108,335.42
You save:  ₦30,957.40
₨13,924.71
List Price:  ₨19,495.71
You save:  ₨5,570.99
฿1,707.62
List Price:  ฿2,390.81
You save:  ฿683.18
₺1,762.36
List Price:  ₺2,467.44
You save:  ₺705.08
B$310.08
List Price:  B$434.14
You save:  B$124.06
R926.14
List Price:  R1,296.68
You save:  R370.53
Лв94.05
List Price:  Лв131.68
You save:  Лв37.62
₩72,995.06
List Price:  ₩102,198.93
You save:  ₩29,203.86
₪183.24
List Price:  ₪256.56
You save:  ₪73.31
₱2,921.84
List Price:  ₱4,090.81
You save:  ₱1,168.96
¥7,853.11
List Price:  ¥10,994.99
You save:  ¥3,141.87
MX$1,006.35
List Price:  MX$1,408.98
You save:  MX$402.62
QR182.19
List Price:  QR255.09
You save:  QR72.89
P691.26
List Price:  P967.82
You save:  P276.56
KSh6,461.20
List Price:  KSh9,046.20
You save:  KSh2,585
E£2,544.49
List Price:  E£3,562.49
You save:  E£1,018
ብር6,361.91
List Price:  ብር8,907.19
You save:  ብር2,545.27
Kz45,590.88
List Price:  Kz63,830.88
You save:  Kz18,240
CLP$49,514.09
List Price:  CLP$69,323.69
You save:  CLP$19,809.60
CN¥364.84
List Price:  CN¥510.80
You save:  CN¥145.96
RD$3,032.23
List Price:  RD$4,245.36
You save:  RD$1,213.13
DA6,760.37
List Price:  DA9,465.07
You save:  DA2,704.69
FJ$115.98
List Price:  FJ$162.39
You save:  FJ$46.40
Q385.05
List Price:  Q539.11
You save:  Q154.05
GY$10,455.66
List Price:  GY$14,638.77
You save:  GY$4,183.10
ISK kr6,980.10
List Price:  ISK kr9,772.70
You save:  ISK kr2,792.60
DH502.81
List Price:  DH703.98
You save:  DH201.16
L922.32
List Price:  L1,291.33
You save:  L369
ден2,959.81
List Price:  ден4,143.97
You save:  ден1,184.16
MOP$399.96
List Price:  MOP$559.97
You save:  MOP$160.01
N$920.98
List Price:  N$1,289.45
You save:  N$368.46
C$1,839.04
List Price:  C$2,574.80
You save:  C$735.76
रु6,810.12
List Price:  रु9,534.71
You save:  रु2,724.59
S/186.41
List Price:  S/260.99
You save:  S/74.57
K202.74
List Price:  K283.85
You save:  K81.11
SAR187.78
List Price:  SAR262.91
You save:  SAR75.12
ZK1,383.10
List Price:  ZK1,936.45
You save:  ZK553.35
L239.36
List Price:  L335.12
You save:  L95.76
Kč1,209.95
List Price:  Kč1,694.03
You save:  Kč484.08
Ft19,835.61
List Price:  Ft27,771.44
You save:  Ft7,935.83
SEK kr553.09
List Price:  SEK kr774.38
You save:  SEK kr221.28
ARS$51,277.48
List Price:  ARS$71,792.58
You save:  ARS$20,515.09
Bs346.08
List Price:  Bs484.55
You save:  Bs138.46
COP$219,391.32
List Price:  COP$307,165.41
You save:  COP$87,774.08
₡25,377.51
List Price:  ₡35,530.54
You save:  ₡10,153.03
L1,269.45
List Price:  L1,777.33
You save:  L507.88
₲390,156.27
List Price:  ₲546,250
You save:  ₲156,093.73
$U2,225.52
List Price:  $U3,115.91
You save:  $U890.38
zł205.57
List Price:  zł287.82
You save:  zł82.24
Already have an account? Log In

Transcript

This conference will now be recorded. So till now we discuss how we can put a new record on my object using my insert statement, like maybe a DML statement, or when the database method, we discuss about database dot insert, or we inserted using do statements insert. I hope in this you order you're correct. any confusion do you're not committed to this? Yeah, I'm good. I don't have anything.

Okay. So then, today we'll go and discuss Okay, I insert the record on my object Okay. And then after that, what we can do is whenever I have said the data and data nothing but it stays on my object. So that means I said there is some object and the object I have to data on record by using my DML statement which I said it's an import my insert statement. So, now the operations what I have said before it can be CRUD operations nothing work, create, read, update, and delete. So, for the create what we use, we use my insert statement, it can be either insert or it can be the insert method.

Okay. So now when I say read, so now, when I want to do the data, and to read mechanism, what is going to happen? serviceman's come with two things? So are we going to read the data from a click one object, or from multiple objects, you want to get the data or you want to read the data? So what we do here, this theory, I think, what we say is we have to write something called query language. So we'll see what it is query language and how we can do and this will double quoted numbers.

So when I say query language, if I'm targeting to read the data exactly from one object, I can say that kind of thing we're going to do, it is all about my SQL, which we call Salesforce object query language. Okay. And same time, as always, you have already seen like some global search and many things. So when I do something called Global Search, it's nothing but it is going to access or searching the data in many objects wherever they're touching, and that intelligent, but that's nothing but also getting the data from different different objects. So that I can say, whenever I'm going to query it may be either so good or it may be so I said, so which is a Salesforce objects such numbers. So the basic question is okay, this is completely in detail, just to know now is this satisfied For those objects learners I suppose object source, but these two things.

So, now, whenever I want to get the data of a particular object either disappear and whenever you want to get data from various objects, we can go bonuses, but now, what we can do so, in the previous example, I just insert one account record, but in what I can say some kind of record I have inserted. So, if I want to read this data then what I do, I have to write a SQL statement. So, avoid everything I want to write in a second statement how we can write so far that I have to use my sink I have to use my soup in the northern sea. What is the so called syntax party this is someone who understood whenever they want to query the data providers simply we can use mine as a sample language nothing What I can say And then whenever I'm going to write Yes, okay, so far is the sentence.

So I will start with a very basic thing. So why didn't happen? Let me give you an example. Let's see, this is one account object. So you tell me if this is a con object, what kind of thing going to happen on this? So I want let's see you, your manager says okay, you are a sales manager says okay, just give me the list of cold who are registered in the month of August.

So now, if this is your account object for whenever I say I want the list of account, who created or registered on my system in the month of August? So it may be one account or it may be hundred accounts or maybe thousands? I mean, correct. Okay, so it may return me many items. So which I can say list of albums. So that means I can say, whenever I'm going to write this is so cool statement part is going to happen.

So don't be super strict when can be done these things are sometimes I can say, Okay, give me the maximum revenue this month. Okay, so that then let's say I want a unique account who have the maximum revenue, so that then we can return a single record also. So whenever I'm going to write a will, I will get this Indian record, or I can get a list of records. Sometimes I can say, okay, on this subject, tell me how many accounts we have how many accounts we have created in the month of August. So it may be 20. I don't have a gun.

I just wanted number. I don't want the complete list. I just need a number. All many accounts are created on the month of August. So that when I say like this, it may return me some kind of integer. So now, whenever I'm going to write this again, it's it may tell you a single record, it may return you a collection of records, or it may return you one number, depending on what kind of syntax or what kind Okay, so when I'm writing, so let's see, what is the basic syntax to write a SQL statement?

So every SQL statement, we're going to start start listening. So wherever you see a SELECT clause, it is nothing word. One is local state management official who can leave my data from the object. Okay, so now what can we do? So select what are you want to select? Then you heard Susie pay?

Dopiest? I think so. Part of the things you want to use all the thing you can use as a concentrator to complete it. So then it comes to problems. Oh, that that object Australia, then do you want to put some condition Okay, as I said, I want to get the articles which are created in the month of August. So I just put a condition account created in August get it.

So now all that are in the condition the condition so you can right here, I can see my condition where condition. This is the very basic syntax of writing. So, if I write this statement, it's not going to give me some records of the subject. Okay, if my condition match. Okay, this is a very basic condition. Let me write one basic example for you.

If I go here, let me open my Developer Console. Okay, so from Tableau console, so how I'm going to write my circle right now. So now, even you can do in the workbench, or you can do in the class area, let me show you from the developer console how it looks like now. So now if I go here, if I go to my query editor here, so what I want, I can write some a simpler assertion query to get it. So my SQL statements are to select. So let's see, I want the ID field I want them to from account.

I'm not going to do any condition. Now. If I do this, my thing is going to return me all the documents. Okay, let's see I want the account whose name start with this. Other other names, name name things, okay? So I this is my account.

Okay? So I want the account whose name is this one, the same day I can do it. See, with this SELECT statement, I got a list of records, the modular segment can return a collection, this collection or my investment also can return some injected one as you can see, we do radio incident wonder, okay? Now this is a syntax where you can write this as a statement to get a record from my object. Okay, so this is not a word, very simple as a contract provided, select a list, and in this query, I have only to pay which I call ID or net. Okay, so now you can see the complete syntax of a circle, don't scare, okay, it's very easy.

I can break it into small small part. So the complex syntax of so called EPC is going to select Okay, your premiums or whatever things I'm going to write inside the packet that you After, okay, so now with that what's going to happen? I can specify some kind of sub query also, I'll explain in upcoming lessons like how I'm going to use this sub query, okay? And like this, we can have multiple sub queries. And then I can define some good something called typo Phil isn't a complete syntax for my talk. So it's going to be type of field.

I just been each everything, then you can define me for an exhibition. Like this. You can depend on multiples. Yes, parties are going to be my expression. Don't only see this interest in power To do it, I wonder what is the most complex also all different kinds of combinations what we are going to use in a survey, we can type here, okay? Then I'm going to use from for each object so I can leave my objects in them, okay?

Then the alias also we can use spider the same thing. Okay. So now if you want to use the scope that digit number one one clause in a SQL statement, which I saw you on day one, so now what is the scope is optional for me. If we need then we can use so I'm just going to scope so some filter scope we can define here Okay, then I can define the condition. This is also optional. If you want to filter the records based on condition, then you can use my foil condition.

Okay. Then, if you have your data category in your system Knowledge management interface See, if the data category is set in a system then you can query based on data category if you want that kind of thing, then we can use my with clause So, wheat and data category alternatively you have and if you want any printer expression that also you can use for this, so, complex syntax but to not interfere, so, we will always use the links in the form of each object and what conditions Okay. Then also we can use the group by So, if you want to grow by the recursive version such as speak pain, then you can grow by So, by who is when you want to grow by that list you can specify here nothing but my field or list on quickly I want to, I want to go play, okay.

So, you can either go by by ascending or By descending okay. So, again if you want to see the top records that you can use the limits okay. So limit number of rows you want to limit that you can use okay. And if you want to skip some record simply you can offset So, number one row offset or are you going to assess this record? Well you know this is basically we use for the luck. So, you can use the formulas so called viewing or referencing somewhere that also we can use.

And whenever in the update that moment, if you want to track it in the new state or not, that also you can do progress. Tracking like so many classes, we have v one v 1.1 and start the writing program. But if you see the syntax what I'm going to use maximal maximum select the playlist will use a sub query also like my parent child query or my child to parent query that I use here. And then typo basically will not use any like max what is going What is this word, then from object name, then choir condition, then these if you have knowledge management then this clause may work for us. Or if you want to group by then you can group by a particular field as ascending or descending. Then if you want to return the suspect number of rows, we can easily misstatement or we can adjust our statement if you want to skip some records.

Okay then if you want to check if you are querying this record for being rappers, or from referencing somewhere that you can do on your own you also have the operators like this, but now we'll see one by one How am I going to do but very basic syntax I can say it is going to select the list, okay, from which object on well conditions With this I can simply write group by which field. Okay, you're descending or ascending. Or you can say, it can be limited to number of for record, or offset to number of records, that big complex query. I just made. This simple syntax. You can remember this.

Yes. Desperate curiosity I'm asking who generally use limit 30? And opposite Don't be from don't disregard. It will show around 50 Records read that don't do that. Yes, it will, it will skip past only records then it was so that it makes records. So if you're using a number N means it will show for n plus one, right?

Correct. Correct. It will skip that. Yes, notice, okay. This is a very basic syntax, but I'm going to assess the records. Let me show you how I'm going to do programmatically these things.

Okay. So now, let me open up Mind Developer Console, and I'm going to open my terminal window. And like how I used to create the accounts. Let me get some accounts. Let me query some accounts. Okay.

So whenever I want to use so clear in epics what I need to do. So my opinion is a carriage return either a list or a single record, or what is that let's see, I want to query all the accounts with document ID name, type and rating. So as I said, for how you want to write query, all right, select quantity opinion. So these are my APA names. And then I just want to put some pointers. Okay, for now, writing is good enough is when I mean always remember this would be close in my screen.

Okay. Now this is going to return me This is going to return me a list of accounts on Colorado. So, I can simply read the list. Now I can give you my one small segment please shows me even in the segment indirectly I can get my account records which I can store here. any confusion on this line of war spent? Okay, so now I will say See, I don't know right now if you see can you see in my account Okay, let me insert an account I can see some of them so we can see on the subject and do I have record or not by seeing this code?

We can see I'm incorrect. So now random list collection methods what I have explained in the previous examples, that helps you Okay, so now if you want to check Okay, my account had some record or not give me an account. Have some records. Then I'll go on for some logic then what I can do I can use my if statement just one minute give me okay then I can use my if statements to check IE how if I have my record or not okay. So, what are you doing here for simply I have explained you many lists collection methods, you can use your existing list, you can use the size like this agent Do whatever you want. If size is given here, that means, I have nothing you can do one more thing you want the same way.

Okay, I want Okay, I want to get the all our columns but with a particular conditions. So how I'm going to write these conditions and what kind of conditions we can write here. Okay. So whenever we are writing a statement, a SQL statement, let me tell you some interesting facts here. Okay. Okay.

I can right click, I have a big object, one object and we have many fields. Okay. And try to assess all the fields what kind of limitations we have to consider here. Okay. So whenever you write a SQL statement so if you see this statement it's having few number of characters we kept you need to count there is some number of characters. So whenever you write a SQL statement, always remember by default so kill statements don't eat junk, okay.

So in the length you should have maximum characters, okay. You could write you could write one so called statement whenever so like that you just think are going to write and what you can do there. Okay. So now, whenever I want to put a condition in though, okay, I understood at least I can do moderator object name from which object I want to assess. Then, welcome And so, in the where condition what I can do okay. Now you can write anything in the world condition or a quad the things I can do.

So, there is nothing more of a clause. So, that means See, I can put some kind of conditional expression based on that only I get the record from my object. So, like I want to get back home was created today. So, nothing but I can put some kind of oil clothes to filter out which record I want. So, in that wear condition, what I can use, I can use my logical operations, like all in all these things, okay, we'll see what kind of operations we have. We can use my equal to greater than, less than all this optimism So, so, we can use, even not equal for wealth and it's nothing but I'm going to Some logical conditions to filter out my record, we can add multiple expressions in conditions like I can say, I want to get the cones with type as type as industrial, and I think as cool so they're kind of on their own.

So you want to get so now I'm just inputting multiple conditions. So you can add multiple field expressions or conditions on the SQL statement for my logical operations to filter out what records I want. Okay, so when I say filter conditions, I'm just saying it can be alright it can be or it can be not It can be anything and whenever I want to use what it can do, so it should be look like this. Oil, my field exclusive one, and mine. Listen to this would be like this. Do you want to use all So, what you can do within two days simply go and write by or condition like this, okay.

So, if you if I want to use any other things like a we have like shipment.or in let me let me show you one thing one example let me show you patterns. So, I have many accounts, but now I want to get a column for your type equal to industry okay and I want to get for electing equal to I want this across. So, the penny wanting to call this a simple statement, let me show you the expression of it, how it looks like am I going to get in record or not? Since there is one account, but I will industrial reading. So I kept multiple field conditions without condition. Let us all So if any of this, if you do cones matching either of type industrial, or routing or everything else is great.

This is industrial, we thought, Okay, this is some other table for accounts, but everything is out everything. So you have a look, I don't I just do not want to give it the commerce of industrial and reading not equal what I want this kind of thing or the candle. Let me integrate it. I got many accounts here. So here you can see my type. And you can see what I'm reading this depending on where you can get it.

So I'm trying to say here I can get everything. So now my health condition can have logical sense I can have my mathematical operations like give them equal to which also logical type of thing, and we can see what we can do. So now let's see. I want to get the accounts where my name is it can be 2021 everything So now, what we can do here? Okay, let me write it right here. So I want to get accounts for here.

Name equal to, I'm just removing these conditions. And I'm just going to write for your name equal to. Now, is it a good 20? So this is going to be a good one. So, if I just go and loop on this collection to think what other calls I have received, I can use Outlook. So what is my collection?

My collection nothing What a system is, am I correct? So now, I can just write this 1234. All right, just simply which is I'm just going to show you here. This is a document can see what kind of content is going to get you Now you can go ahead, just simply I'm going to take a look at it. Let's see the logic exactly one matching and I'll get it now, if it only then you see I got 200 but I want to get all the accounts wherever I have a cc record studying. So, if you see I have many accounts starting with the SEC record like 2021 2010 everything I want to get for that I want I do some operations there.

So, now what I do instead of name like this, I can just directly type name like so, whenever likely that means I want to see inquire about that name starting with the with this. So I want to assess this. So you can use my percentage symbol here. So if you right is that means in the SQL statement from the subject, wherever there is a name starting with is good. And after this everything maybe we know matters. I want to get And then we can use my like message.

If I record the statement, you'll see what records I'm going to get it. I'll get an extract where's all the records? It's the name starting with his record. Okay. So now, let's say I want to get like this you can use if you want to see the name starts with this, okay? Or they want to say name ends with this, you can use like this or you want to see anywhere, this textured match you can give inside this is that that was with the lecture.

Okay, let's see, I want to get a comb, which name equal to two. Okay, let's consider I want to get our own witness 20 and 21. So what I do is, again, I can write or Navy colonies, I'd get the punch. So When you have like this organism, I'll just break it in different way. So this is cool stuff and also works for me. I'll get exactly the accounts The name is matching to this.

Record 20 and 21 I just give two names, okay, I just executed if you see here, I'm going to get both of them. So, whenever you have a requirement like this with multiple of Hello, for one field, instead of name equal equal multiple times right simple you can use like in an essence. So playing keyboard you can use for now, cc 20 or whatever you want, you can use when am I not maybe this is country, oh, my name can be this is. So both records. So instead of writing name equal to d, so these are the countries candidate, simply I can mean a presence to all the values which matching with the pain to get it. So that's goes with my in essence if you have a goal for the next two let me know if you have any questions any question for me okay sorry Ed a difficulty not perfect.

See you whenever it listed when you remember, it may return a collection record, it may return a single record or it may turn a number. So I wrote a segment is returning a list of albums. So, which I can do for a for loop also and I can write my logic here. Okay. So I like my field name 41 from which account and I'm just Using the different conditions I may use on all vertical conditions I can use mean equal to all kinds of options you can use here, okay. So, let's see, I will say I want to get the total number of accounts you have in your system, what you can do simply I can use some kind of a get consents, okay, which I can say let's see, I want to get total number of accounts, but again, I can use the counter What am I doing here is it come from Ebates so sweet.

So, it just gives me the account number, how many accounts I have. So now, whenever you want to, like as I said, my account or my school, can give the collection of records or single record or a integer value. Whenever you have some aggregate functions you use, like calm My SQL statement may return exactly the integer value what I'm getting here. Okay, so, like the counterbore assumes what we have we can get it, but that recall might get on sometime so many other concepts. So what you can do in that case, let's see, I can write total account count defaulter. I can't lie.

I can't give this out, then simply, we can get this from the demo, just for a second. So how many tickets we'll getting on this so that we can get it simply like this. If you go to my debug logs, See, my total concordance, anything I can get programmatically from? Is any question parameter? No. See, I'm just giving you one example of each part.

There are many things which we'll cover one by one point and go to the upcoming systems. Okay? So everything will be the same. Okay, implementation on one by one. Everything will cover if you go here. Okay, so let's see.

Also in the so called, I can use my debt litigants. There are many there are tutorials, I'll send you the link you can see our let me show you now you can just pull it out. I'll say all the terms. I'm not saying you remember, okay. You just know where you can get it. So just deleted once.

You can get it. Now I want to get the accounts we created this week or I want to get back home. We just created on this quarter. So what it can do for that I have some debt, even want to get account which I created yesterday, simply you can use a certain line select it from accounts were created that equalization. Same way I can use today, wherever I want. If I want something for today, let's see the opportunity.

And I said opportunity closures would be tomorrow. So I want to take whoever the applicant is going to be close tomorrow. Simply I can use tomorrow as a dead letter. Yes. Same way either onto the call my last week I can simply use last week here. Debt literals.

Or if you want to refer this week, what are the accounts calculated? You can simply use this you can just get literals can be used in a circle for any objects semi this week or next week. You can record next week. If you want to record my last month you can increase or this month you can do this for less money. Kenya's national national Mr month like this, if you want to refer some number of days simply you can use my last 90 days best 90 days or you can say last 10 days and you can use with a Nigerian. So, like in last 365 days, you can use like the last underscore a underscore days column 365.

So, in next same way you can do next n days and next Enric last dynamic next and what all the semicolon, you can put in the query filters and you can get it so like this quarter, okay, everything you can do undergoing each one of these. So if you want, you can just try one on so you can query for this, and this is a very good thing to write the sequels for two we need always to patients is dead filters. We may need the recipient to get the data when it ends. Okay, so you can you can try this one kilometer Just went. Yeah, bro. Yeah, you can try these different different data literals for your coding you one, or any if you try it, if you get stuck in here, I'll help you.

Okay. So there are many, many literals you have to use only one simple sample. So you can see here same way, you can write on a circle statement, and you can see, am I going to get the record or not? So for instance, you can go to here, and I'll just say, let's see. Select the ID or name from our column. Oh, yeah.

Dead equal to last week. You're good. See, I have 22 Records created last week, but I didn't do it last week. So do you think anything of this way? I can just say if this week, in particular I didn't create anything district Okay, like this I can use all these things. So now let's see if I want to let's get all the accounts See I just got all the accounts ID name from upon everything get here.

So now I want to sort the accounts based on their name, but that time what I can do, I can reach my order by so simply I can go on the order by which when I want order by name, so you want to order by descending or ascending okay so that you can see straight here how you want to see I want to order by descending. So ischemia descending order, if I want to order by ascending, simply I can use is use average ladies. in what order Do you want to get records that obviously can set based on your ascending or descending clause what we're going to give that depends on like what kind of reverse Okay, any question permitted Oh. So on the circle one more thing I saw you see, whenever I use select ID name pro account, I am getting all my 30 seconds, I do not want to get all 35 accounts.

So I just want to get past five opponents. So what I can do simply, I can use a well let me just remove my auto replace here select ID name, provocateur I have played I'm getting all these accounts. But let's I want to get my top two options, I can simply use limit. So how many accounts you want the number here, you can simply use this. So let me see I got two accounts. Let's I want this.

Let me show you. I'm just removing this level statement. I'm just going to get all the accounts so I want to keep up to record 27 or record 21. And then I want to get so I want to skip these three records. So what I can do, I can simply use offset three So how many records Do you want to see that you can make? I want to skip this a reverse.

I want to see from account record 22. So I'm just keeping the past three records. So I wrote my offset three. Okay. So there's no certain medical records here and extra costs will be allotted for me. Okay, so now let's see, I want to fit on this one.

Okay, so now, I have political parties, helicopters. So I want to use my limit in an offset 20. So far, so see, I just got 10 Records out from that. Okay, top 10 Records after skipping my own characters, that kind of thing you can see here. So just just a concerted remember for to limit and what offset do we lose in the case of an implementation of how you do using trigger backpacks that they will use this. Okay?

So these are the basic syntax. What we're going To use on May 2, okay. Any question permitted devices? Okay, then I have one question for you. Okay, fine. I'm doing I've said so how many I can I can see in a similar circumstance.

So I just entered here offset 20 Okay, that works fine for me correct? The opposite 20 and then I'm going to Pentacles now in my account, I have many records some millions of records. So how many Avraham Lake what number I can put in offset maximum? I think if I'm not wrong, I think you can use up to 2000 correct. So you can do offset up to 200 rows, no, more than that. Okay.

So if you lose to see now it's okay if I try to use one on one also. Okay to know get maximum discipline absurd and oh, okay, that's just me says just the selfoss. Post limit. So how many records you can skip in the consequence? Okay. Any questions below?

That there was a heavy question. Yes. So if you need to get a record from or to throw in one to 5000 what at that point of time what I need to do so when I'm doing program so if I need to get a records from two, for example, my requirement is I need to get your records for 2022 starts with like don't don't get triggered in a particular object to fight Oh, in regards to not the point of time what I need to do. Well, so now for the quarter do here. There are many approaches. Okay.

So whenever you see in that case, our Yes Okay, so sadly, not so good. Not going to work. So the opposite is not going to work in a circle. Because we want to skip through more than 200 acres. So in that one what is going to happen? So for the accounts you have got everything in the list now, let's consider this account giving me 50,000 Records Okay.

So now when I got a new record I can do so I know what is my total count. So it can add some kind of look like this. Okay. So from integer i equals o comma decoding on escape, you want to escape my tuxedo, the chords that I left them there See, my all comfortable How can I use like this? Then, my pastor Can we start showing my assistant and stuff I can say the pastor 141 is going to be done and I could make this so anything start familiar To start wanting to correct the index, so of course, I just query everything being indexed here. Correct.

If you see this account, this is the index, you know, 12345. But now, I can write this way to skip triggers. We call it from that is what I'm skipping programmatically in my logic. So my for loop. We can all right, yeah. Good.

Yes. Yes. That's looks good. Yeah, many approaches there. But anything, I just gave you a simple applause. Thank you.

Okay. So you can do so now. Okay. We understood the very basic of ethical statements like key, what is a SQL statement? And what is the basic syntax and how to use the well concerning the absurd order by everything. So now, let me ask you one when basically So now sometimes you see, whenever I'm writing these ethical statements, what's going to happen?

If you see? Let me go here. Let's make it open. So now my objects are connected in IntelliSense. Okay? It may look up or massage or anything.

So I have a account object, okay. And also I have a contact object. So in this part, what is going to happen? So they have a relationship, like one account can have multiple contests. Am I correct? Multiple concert.

So now, this is very loose and similar thing, but many one too many, correct? Yeah, that's true. All right. So, now, I am calling one contact record. Let's see, I have an account record which name is a one man icon. Now you have a contract with nothing but c one.

Now I'm writing a query statement on my contact record, and this content associate to a one for now. And I'm putting this child record, I want to access my parent record, also how I can do it. So now, in the second statement, we'll see whenever we are showing the child record, only can hear the parent. Same way, whenever I'm calling the parent account, this account they want me to have multiple contacts for C one C, two, C, three, all my contacts. So whenever I'm querying this account via one, so now we'll see whatever the contracts we have multiple contracts I want to get. That means when I'm querying the parent records, how I can get my child records.

Okay, so let's see what I can say. We'll see how I can write my parents. Okay, this whole thing we did Understand in this a good college something okay, so whenever I'm saying my child and parent query, why does it mean let me in soil that with going to my object level. So now if I go to contact let's I'm talking about contact according to the standard objects. Same way it's applicable to my custom object also. So by now I'm in the context of Jake.

So, let me go to my object manager. So, if I go to my content object, so between contact and account intelligent licensee apart is my realism Cpl. Witten conduct account, nothing but my account name is recency P. I correct. So now, coin ID finally listen to what happened always. So for every relationship with you, whenever you create a relationship field or anything you could remember when Just provided one relationship name here. So, the moment you create a relationship feel when you look over my shoulder, we used to give a relationship field name okay.

And also child to parent is nothing but one path whenever you come this is my parent, this is my child. So we have a relationship now nothing but I can say it's a part two travels from parent to child. And also goin I see the child from the child you can see decorative up name we have used okay to refer my parent which my parent now if you initiate contact, the APA name will use account ID equals nothing but going to my account field and if you go to my account, that is you see, there is also called a child innocence same thing we are here we have my paint, APA name and We have also changed to the sensitive man. So always remember, whenever I want to navigate from the child query to parent record, when I'm quoting the child record from that child, record the parent, navigate to the parent record in what I'm calling on the contact or contact object.

And I want to navigate to account records because contact is the size of account, or they can use, I can use my APA pointer i'm used, okay, the pa pa pa is with underscore underscore, navigate to here. So APA. If it's a custom, then you have to add to underscore underscore our for my custom recency field, or the standard field simply the same API name I can use to navigate to my parent. So now what I'm going to do here, whenever I am in my parent query, and when parent to child records I want to answer is simply i can i say is using my child relationship name. Okay. So how We are going to do it.

Let let me let me see it. Okay. Any computer until now? Is it clear? no confusion. There was this yesterday could be explained on what time that earliest relationship.

Sorry, in normal. Yeah, I look up. So I'll do one thing with one small example. I'll show you how it's happening. So it will be more clear to you. Okay, so how this doesn't seem from parent to child, or child or parent ours happening?

We'll see. Like in the right now I have my standard standard update account contact. There only We'll see. Okay. So let's consider, I'm just going to query my account object. Okay.

So what I do for querying the account object record, I do ID name from account. I do like this one record. So now, so account may have some content. So whenever I'm querying this account, I want to cremate child contact record also. So that we specify whenever I'm calling my child record from parent, we use sub query Okay, we help do you get some objects, then I can get it. So, from account to query for a new account to contact when you see in the contact, there is JP account name, which is common with child relationship name dependents, contracts.

Am I correct? contracts. So now we'll see how we're going to do it. So now from our Kong. So Cory, when you're writing, let me write in my zip. So whenever I'm writing this query, what you're doing here, let me say.

So now all the soccer is going to start Again, my Okay, so I'm just going to write again, once you just read my inside this illustrate when I write in this statement, and I specify an important one. Last time you want the partner, you want to have content from family equity on the contract corporation to write, select ID and then cast them, then come contract, I should do like write like this, like how to write in a sub account, select ID name type rating from a similar issue like like this. But whenever I'm making a sub query, that means what I mean here. So now if I'm calling on the parent account record, and what are the associated child's associated contacts we have, we probably want to query, simply I'll use the relationship name to query it. So now, when I query the parent record in a semicircle, I can write one sub query one sub query I can write with the help of relationship name to get my contact record.

So to do that, I wrote select ID first name, last name from from here, then I go to my contact the licensee field and I will see what is the relationship name, sorry, the residency name. So whenever you want to come from account to contact or parentage, I use my relationship name. So that's a really sensitive name. I'm going to share some contacts. Okay. So this is going to be calm.

So now this is just a very small sub query, where I can show you the get account associated, change occurs, associated contacts occurs because you've got it Perfect. So now let me use this tell me I want to print the contact names. How will I want to have a system ready book contact name. First you loop a little bit on account list. So if may have so I'll go and buy my account. Okay, so what I'll do here, this is my account list simply I can do account sec, this is a list.

Okay. Then this SSE. So now what happens here? Let me say, technically, so let's account a one I have this account a one my like a one and a tie everything everything and in this one may have my C one record is also going to be a list once again, see one record See to record see through the code. So my account I have a list of child again the same way I may have account a two, four Yeah, I may have again let's see one one, c one, C two, like this. So from one account I've been getting a list of records.

So now my new loop on this is going to want to come. So, this is going to represent a wonderful and is titled record also whatever you have, so how you do it. So now you can change it or may not have the contact okay. So we can say the account what I have now the SEC, the contacts record is there or not is the contents not required. Now you can write or you can take doubletake. Also you can do a pre contest any confusion in this student because we are going to use this many times in the real time.

Okay? So what does it mean? I'm just again, my account and the real essence of curry what I got it have some record and not just one account, like all accounts may not happen. So I just want to move on the context where I have I have the contact details. So what I can do here, then I can make a note here. Okay.

So in the loop, I'm just going to right I'm just now going to look on the contract of con. So, this is a contract something but you can want this to contest. This one. I think what makes this contest then I can go on the complete system, the deeper my contract next in all the continents. I can do this in contacts. Okay, let's see conduct partner.

And then I want to give a space on the plane. And companies can double check on your skin contact details up account, I can write as your name it like this. So you've got this piece of code. Now see what is going to happen next reading this, okay, I just made a simple scene I just go on he couldn't even go here. Let me show you what kind of outcome we're going mq si contact details of this account this is my contact for this account this is the contact you can see when they want everything to correct. So, any question on the support, you need to understand the basics you need to understand unless you have any questions on this device.

So, essentially what we are trying to do like we are just trying to hit some record where primary lessons is paid. Well, this one is master and when you Okay, so, this is meant for you, right, it's going to have a relationship query is a query from the parent which I call the Barrett, Ontario child. Yeah. Then we are using that inside that query, right. We're using a sub query, very easy and we are using that relationship name right. Got a tangible essence if name, but you want to do in other way like from in come will come I will come we come okay okay so this is the parent a child child can we come?

So with this okay you understood how we can query from parent design using a sub query? Yes, yes. Yes. Correct. And this looping statement encoding condition, you know not that perfect. yes and yes when you know deposition, I don't have any questions, but stay on the screen for a minute, this time seeing one more time.

Okay. Is there anything in particular right now? Perfect, perfect. No, so, yes, when do you want to check if you have anything? So diversity in the mind of mine, if you're not equal to Also no problem right in stuff greater than zero yes they're not accredited also you can use mobile no oh I have only one question devices see here reprinting the context when we are on we are on right if you want a gap between those like in steps if you see diva glasses looking somewhat clumsy red so if any gap hole I need to make a gap in essence I need a line brace it's like the unit level is a key isn't this is not the law but if you want to you simply I just it's not a good thing anyhow we will not use it just simply can keep it just like this empty, empty okay?

This just thing but the appointment right the backup program. We don't need these things just for promoting you will not use the word blood sodium correct. Okay. Your friend documents. Yeah. Perfect.

Super. Okay, so now I'm giving you one question in the paper, similar system, and everything is over. So you have to tell me how many. So Cory I can write in one is a consistent look at comedy. So I can write, you check it and tell me how many like I wrote in this article once a query, how many I can write. Okay, so now, let me see it's a little different.

So I am just putting my contact. So I'm just going to get my contact here, which I say contact list. And to get the query in the contract, what I can do, simply I can use select ID. name from contact. Okay, now what happened yesterday To identify from the contact object when you're writing the content query, query says what is my account time? So that time what do you do?

Whenever you want to go from child to parent, you use my JPA name, okay, you can just standard standard object of salary lesson that again, always you can use underscore, underscore or in the cases, the equal to custom, then use this relationship, child relationship name is also underscore underscore app. And also if you using my child to parent name, also you can use underscore to underscore that simply I use my sensitive name, sorry, my API name, and the time you probably want to see, okay, I want to get a reading. And I want to get back home name, everything I can call it like this. So let's see if I can just do it for nuclear. I can slow you down. In fact, I can stack the list.

Then there simply I can call an interesting system that people can think of. I'm just going to print this line. So highlighted, and I'm including the highlighting. Table strike where you end up looking here and see, if you see in a single query, I can access my contract and few account fields. Also, see, again, you can print everything here. Okay, so you can see the account ID but what if you want to print my account name so everything you can do it, that's how I have system, the debugger.

I want to put in my corner. So simply, I can go and see the main conduct Congressman, I just want to record this month is not on your highlight, so, I can just go here. So, you can see something here. So, like this you can use and you can do any any confusion on this fact. So, my child to parent query or parent to child query, do you have any confusion? The basis I have one question just out of curiosity like here what we are trying to do like we are trying to access one parent record from China right.

Suppose the parent, accounting parent and the contact agent suppose I want to view the number of cases or case detail Tight Can we do that like cases also related to this account right and like the nicest and let me say that for now, you can if you see make it small like them from you. Now, you will tell what you need to do, let's build the logic out. So, you have an account. So, you have one contact correct. So, between these two if you see some account or contact you have one to many relationship correct. This is our account this is an interest rate Okay, yes, okay cases another object okay.

So, in the case primarily, we have linkage from account record, one account may have many contracts and also in the case object, I have a case contract, you can have a case contract correct. Yes. So now that means you have a relationship or one person can associate in many cases. So if you want To see okay, so for this contract, how many cases are there you can use the parent which is good, okay or you want to get this account how many cases you can choose account two cases as a parent. Okay. Okay.

So just to pull the example if we just for example, if you see, I don't have any real essence a bit in contrast to this, okay yes, this like also you can is yes. So now the admin secret coding on the contract. So, you want to see Can I assess this or not in a single query? Right? Yes, yes, no. So in your query, you you can using the Parent to Parent relationship, you can come here to the account level, but I'm here for in the contact query, you cannot use sub query to assess this one.

For example, if it is an option, for example, if it is opportunity, yes, you cannot say that you cannot access it. So why do you want to know logic? So now you corrido all this content, get the wrong quality. Okay, then then again build one more so here are the icons to get this Affirmative. Okay, we're in a list and we can you can write this. Thank you.

Okay. Any more question? Perfect. No? Go to the core ones. Okay.

Yes See this? You have asked one question right for us. So how many how many listens to query I can use how many sub query I can use one. So one parent to child is a good question. Well, I think if I'm not wrong the like equities as paid into the content in the similar way it is paid into opportunity also, right. So yes, They also hear maybe he goes on.

Yes. So so so like this maybe I have one parent and that parent have a totally different child objects. Look at this. So how about how many times Cory I can write in a single parent parent discipline and also say, so I see that you check and confirm, okay. And also same thing you see in the contract. I'm just quoting my accountants.

So just consider I have an object which has one parent and parent parent is having other than any other parent like this. I have a higher protein hierarchy. I can use my child to politically it will be paid between two maybe three anything. Okay. Got my questions. Check it out.

You can solo you have to saw something you need. And check it. Okay. Well one thing you do practice this multiple things, okay? And in the next lesson we'll see about the association and may update and DML statement but find out what is appending that will never recover okay. If you are not No, no no your devil says Yes tell me.

So. So, just I want to know whenever you are discussing with the triggers right. So, at this point, we will you will discuss about qualification and recursive down Yes, yes, yes. So, analysis in the free time I used to check my company code at that point of time a not understanding the what is qualification and recursive. I'll I'll tell you in good emphasis. I think it may be not in our curriculum in this thing, but could you please just or no oops concepts one day Okay, so the basic I was concerned I said before, okay, but I cover up knowledge.

Okay? Yeah, only those two concerns so when you're discussing because yes, yes. Okay. And when you're discussing over the test classes also Could you please go Would you please send somewhat extra time and now that what one more concern these three concepts I have in my mind Yes, noise all everything will do it normally. Okay? Yeah.

Yep. Yeah, yep. Perfect. Then we'll meet in the next lesson we'll discuss on this topic. Thank you guys. Bye bye.

Yep,

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.